Try
$email = $_POST['Email'];
$name = $_POST['Name'];
The indexes/keys are case-sensitive
Pregunta
I really know nothing of PHP. I'm using this template contact form which works.....but when I receive the email, the entered information on the form is not in the email. Am I missing something? thanks
<?php
/* Email Variables */
$emailSubject = 'New Email Subscriber'; /*Make sure this matches the name of your file*/
$webMaster = 'greg@flymedia.ca';
/*design by Mark Leroy @ http://www.helpvid.net*/
/* Data Variables */
$email = $_POST['email'];
$name = $_POST['name'];
$body = <<<EOD
<br><hr><br>
Name: $name <br>
Email: $email <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>sent message</title>
<meta http-equiv="refresh" content="3;URL=http://www.chapswings.com/newsite">
<style type="text/css">
<!--
body {
background-color: #000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 20px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #fec001;
text-decoration: none;
padding-top: 200px;
margin: auto;
width: 800px;
}
-->
</style>
</head>
<div align="center">Thank you! Your email has been successfully submitted</div>
</div>
</body>
</html>
EOD;
echo "$theResults";
?>
<form id="contact-form" name="contact-form" method="post" action="form-processing.php">
<p style="=padding:0; margin:0; font-family:Arial, Helvetica, sans-serif;size:10px;">
<label>Name:<br />
<input name="Name" type="text" id="FName" size="25" />
</label>
</p>
<p style="=padding:0; margin:0; font-family:Arial, Helvetica, sans-serif;size:10px;">
<label>Email:<br />
<input name="Email" type="text" id="Email" size="25" />
</label>
</p>
<p>
<label>
<input name="button" type="submit" class="submit-button" id="button" value="Send" />
</label>
</p>
</form>
Solución
Try
$email = $_POST['Email'];
$name = $_POST['Name'];
The indexes/keys are case-sensitive
Otros consejos
There are a few things wrong.
First as I said, no spaces before or after EOD;
heredocs are funny that way (in case there are any, and there are some in your posted code) so I thought I would make a note about that, just in case.
And your form inputs are called name="Name"
and name="Email"
yet your $_POST
variables are:
$email = $_POST['email']; // notice the lowercase "e"
$name = $_POST['name']; // notice the lowercase "n"
You need to change that to:
name="name"
and name="email"
or make the appropriate changes to your $_POST
variables.