PDA

View Full Version : Any errors in this PHP form submission script?



LetJimiTakeOver
19 Oct 2010, 09:56 AM
Hey guys. I can't quite get this script to work. As far as I know, I have it set up properly (ie. the form Action is emailformscript.php, and Method is POST).


<?php

/* Subject and Email Variables */

$emailSubject = 'Crazy PHP Scripting!';
$webMaster = 'bob.lewisr@gmail.com';

/* Gathering Data Variables */

$nameField = $_POST('name');
$emailField = $_POST('email');
$phoneField = $_POST('phone');
$dealsField = $_POST('deals');
$additionalinfoField = $_POST('additionalinfo');

$body = <<<EOD
<br><hr><br>
Name: $name <br>
Email: $email <br>
Phone Number: $phone <br>
Deals: $deals <br>
Additional Info: $additionalinfo <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>
<title>JakesWorks - travel made easy-Homepage</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #f1f1f1;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #666666;
text-decoration: none;
}
-->
</style>
</head>

<div>
<div align="left">Thank you for your interest! Your email will be answered very soon!</div>
</div>
</body>
</html>
EOD;
echo "$theResults";


?>



Can you see any discrepancies in my code? If you want to give it a go, go to www.icstestsite.com/contact (http://www.icstestsite.com/contact.html) and you can see what happens when I try to submit. Thanks!