Hi,
I am totally new to php and web design. I have got an online form on my site, which uses a PHP script to email it to me. I learnt to create the script from this tutorial:
http://www.tutvid.com/tutorials/dreamweaver/tutorials/phpFormHandler.php
However when I tried to use the form i get this error message:
500 - Internal Server Error. The resource you are looking for cannot be displayed.
The tutorial demonstrates it all working perfectly, so I know the tutorial is good, and therefore is something I am doing wrong or not doing at all!
I do get an email through, and the email body is exactly as specified in the script, however it doesn't grab the data from the form, or display the outcome page the script specifies. Just the error message! Please help, I am in dire need of it!!
My PHP script is:
<?php
/ Subject and Email Variables /
$emailSubject = 'General Web Enquiry';
$webMaster = 'example@example.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'];
/ The email body /
$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 : example@example.com</p>
<p>Web Concepts : example@example.com</p>
<p>Photography : example@example.com</p>
<p>Enquiries : example@example.com</p>
<p> </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";
?>