Need help with my PHP email processing script

ash bullman's Avatar
Newbie Member
I am new to PHP and found a tutorial to send the information from a form on my site to my email.
If it helps, the tutorial is from tutvid. com.

When I tried to test the form, all I get is this:
500 - Internal Server Error. The resource you are looking cannot be displayed.

The tutorial demonstrates the whole thing working fine, so either I'm doing something wrong, or not doing something at all.

I do usually get an email, with the body exactly as the script specifies, however it does not grab the form data. Nor does the script produce the outcome page it should. I have been over my script in detail and it is exactly as the tutorial says it should be, yet his works and mine doesn't! Please help!

My script is:

PHP Code:
/* Subject and Email Variables */
$emailSubject 'General Web Enquiry';
$webMaster '';
/* Gathering Data Variables */
$nameField $_POST['name'];
$emailField $_POST['email'];
$address1Field $_POST['address1'];
$address2Field $_POST['address2'];
$townField $_POST['town'];
$postcodeField $_POST['postcode'];
$phoneField $_POST['phone'];
$serviceField $_POST['service'];
$brochureField $_POST['brochure'];
$aboutusField $_POST['aboutus'];
$oursiteField $_POST['oursite'];
$commentsField $_POST['comments'];
$body = <<<EOD
$name <br>
$email <br>
First Address Line: 
$address1 <br>
Second Address Line: 
$address2 <br>
Address Town: 
$town <br>
$postcode <br>
$phone <br>
Service Enquiry: 
$service <br>
Send Brochure: 
$brochure <br>
How Did They Find Us: 
$aboutus <br>
Did They Like Our Site: 
$oursite <br>
Client Comments: 
$comments <br>
$headers "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success mail($webMaster$emailSubject$body$headers);
/*Results Rendered As HTML */
$theResults = <<<EOD
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Kyu Images | Web Design | Logo Design | Brand Image | Photography</title>
<link href="../css/main_layout.css" rel="stylesheet" type="text/css" />
<link href="../css/servicepage_layout.css" rel="stylesheet" type="text/css" />
<link href="../css/bracket.css" rel="stylesheet" type="text/css" />
<style type="text/css">
a:link {
text-decoration: none;
color: #000;
a:visited {
text-decoration: none;
color: #000;
a:hover {
text-decoration: none;
color: #000;
a:active {
text-decoration: none;
color: #000;
<div id="wrapper">
<div id="banner">
<div id="title">
<h1 align="center"><span class="bracket">[</span> Contact Us <span class="bracket">]</span></h1>
<div id="navigationbar">
<div align="center">
<h2>Thank your email, it has been successfully sent. We shall soon receive it and will respond as soon as possible.</h2>
<div id="mainbody">
<div id="content">
<p>If your query requires an urgent reply, or you already have a project underway with us, you can email directly to the relevent person:</p>
<p>Concept Arts :</p>
<p>Web Concepts :</p>
<p>Photography :</p>
<p>Enquiries :</p>
<p>Or telephone : 01502 281284 between 09:00 - 18:00 Monday to Friday, and 10:00 - 15:00 Saturday.</p></div>
<div id="levels">
<h2 align="right">Please choose where to go next:</h2>
<p align="right"><span class="bracket">[</span> <a href="../index.html" target="_parent">Home</a> <span class="bracket">]</span></p>
<p align="right"><span class="bracket">[</span> <a href="../about_us.html" target="_parent">About Us</a> <span class="bracket">]</span></p>
<p align="right"><span class="bracket">[</span> <a href="../corporate-identity/web_design.html" target="_parent">Web Design</a> <span class="bracket">]</span></p>
<p align="right"><span class="bracket">[</span> <a href="../corporate-identity/logo_design.html" target="_parent">Logo Design</a> <spanclass="bracket">]</span></p>
<p align="right"><span class="bracket">[</span> <a href="../corporate-identity/brand_image.html" target="_parent">Brand Imaging</a> <span class="bracket">]</span></p>
<p align="right"><span class="bracket">[</span> <a href="../photography/photography.html" target="_parent">Photography</a> <span class="bracket">]</span></p>
<div id="mininav">
<div align="center"></div></div>

Last edited by shabbir; 1Nov2009 at 10:59.. Reason: Code blocks
nimesh's Avatar, Join Date: Apr 2009
Invasive contributor
Can you also post the form code?

And use the code tags to display your code.
ash bullman's Avatar
Newbie Member
Hi, thanks for the reply,
I am a little unsure of what you mean by using the code tags to display the code?

I tried to post the code, but got this message:
Too many live links/images found in your post content. Please edit your post or contact the administrator.
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
I have done that for you.