View Full Version : PHP form not sending email in correct format

05-29-2012, 04:12 PM
I have a form on my page that sends an email to whoever, it sends the email so far, but it doesnt include any of the variables in it.

My test site is up at www.trendstudiosorlando.com/test3/index.htm

As of now, my php page is coded as follows: ( I have blocked out the email, but obviously it can be seen if you check, lol. Is my code wrong?

$errors = '';
$myemail = '********';//<-----Put Your email address here.
if(empty($_POST['name']) ||
empty($_POST['email']) ||
$errors .= "\n Error: all fields are required";

$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];

$to = $myemail;
$email_subject = "You have an appointment request!: $name";
$email_body = "You have received an appointment request. ".
" Here are the details:\n Name: $name \n Email: $email \n Phone Number: $phone \n Details \n $comments";

$headers = "From: $myemail\n";
$headers .= "Reply-To: $email";

//redirect to the 'thank you' page
header('Location: contact-form-thank-you.html');
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<title>Thank you</title>

<!-- This page is displayed only if there is some error -->
echo nl2br($errors);


05-29-2012, 04:55 PM
The contact form is missing name attributes for the input fields. In the absence of these there will be no POST data.

05-29-2012, 07:21 PM
GOT IT! Thanks!