Hi,
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:
<?php
/* Subject and Email Variables */
$emailSubject 'General Web Enquiry';
$webMaster 'enquiries@kyu-images.com';
 
/* 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
<br><hr><br>
Name: 
$name <br>
Email: 
$email <br>
First Address Line: 
$address1 <br>
Second Address Line: 
$address2 <br>
Address Town: 
$town <br>
Postcode: 
$postcode <br>
Telephone: 
$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>
<br><hr><br>
EOD;
$headers "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success mail($webMaster$emailSubject$body$headers);
 
/*Results Rendered As HTML */
$theResults = <<<EOD
<html>
<head>
<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;
}
-->
</style></head>
<body>
<div id="wrapper">
<div id="banner">
<div id="title">
<h1 align="center"><span class="bracket">[</span> Contact Us <span class="bracket">]</span></h1>
</div>
<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>
</div>
</div>
<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 : conceptarts@kyu-images.com</p>
<p>Web Concepts : webconcepts@kyu-images.com</p>
<p>Photography : photography@kyu-images.com</p>
<p>Enquiries : enquiries@kyu-images.com</p>
<p>&nbsp;</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>
</div>
<div id="mininav">
<div align="center"></div></div>
</div>
</body>
</html>
EOD;
echo 
"$theResults";
?>

Last edited by shabbir; 1Nov2009 at 10:59.. Reason: Code blocks