Topic: SOS! PHP Email processing script returns "500 - Internal Server Error"
Hi, I am in urgent need of some professional advice, I needed an online
form to send some info to me on my site, so
I found a tutorial for setting up a form with dreamweaver cs4, and
writing a PHP script to email it to my inbox, and then view a page
after it has been sent.
However, when the site was uploaded and I tested the form I get a
error message:
*500 - Internal server error.*
*There is a problem with the resource you are looking for, and it
cannot be displayed.*
In addition to this, I do get an email come through (sometimes), but
it does not have the user data entered in form. The body is there,
just no data!
I have seen loads of blogs and forums, but nothing has been able to
resolve the issue, please can you help? The script is exactly as the
tutorial demonstrates, and the guy even shows it working. Obviously I
have entered my own variables. If it helps the tutorial is from
www.tutvid.com - choose the tutorials tab , then
dreamweaver, and its near the bottom.
If you can help, I would be forever in your debt.
Here is the PHP script. The form action directs to the script and the
method is POST.
<?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> </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";
?>
