Hi I've coded a basic contact form -- everything seems to work fine except when I test it out the information that I've input in my text fields doesn't show up. I recieve the email with the but there's no information in the name, email and comments section, even though i've filled them out. Can anyone spot what I'm doing wrong?
Here's the php code:
<?php
/ Subjects and Email Variables /
$emailSubject = 'Contact Form Email';
$webMaster = 'myemail@gmail.com';
/ Gathering Data Variables /
$nameField = $_POST['name'];
$emailField = $_POST['email'];
$commentsField = $_POST['comments'];
$body = <<<EOD
<br><hr><br>
Name: $name <br>
Email: $email <br>
Comments: $comments <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);
/ Restult rendered as HTML /
$theResults = <<<EOD
<html>
<head>
<title>Always En Vogue: Thank You!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #240807;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #AF9982;
text-decoration: none;
}
-->
</style>
</head>
<div>
<div align="left">Thank you for your comments! I hope you enjoy the site!</div>
</div>
</body>
</html>
EOD;
echo "$theResults";
?>
Here's the form:
<form action="contactformprocess.php" method="post" name="form1">
<table width="100%" border="0" cellpadding="6">
<tr>
<td><label for="name"> </label>
<div align="right">Name:</div></td>
<td><div align="left">
<input name="name" type="text" id="name" size="35" maxlength="80">
</div></td>
</tr>
<tr>
<td><label for="email"> </label>
<div align="right">Email:</div></td>
<td><div align="left">
<input name="email" type="text" id="email" size="35" maxlength="90">
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="comments">Comments:</label>
</div></td>
<td><div align="left">
<textarea name="comments" id="comments" cols="27" rows="5"></textarea>
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="clear"></label>
<input type="reset" name="clear" id="clear" value="Clear Form">
</div></td>
<td><div align="left">
<label for="submit"></label>
<input type="submit" name="submit" id="submit" value="Send Email">
</div></td>
</tr>
</table>
</form>
I recieve an email that looks exactly like this:
Name:
Email:
Comments:
But no information is next to the colon even though I've entered in info. Please help if you can. Thanks!