<?php
if (!isset($_POST['submit']))
{
$name=$_POST["name"];
$company=$_POST["company"];
$email=$_POST["email"];
$message=$_POST["message"];
$toaddr="me@me.com";
$subject="Website Contact Form";
$headers = 'From: '.$email.'' . "\r\n" .
'Reply-To: '.$email.'' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$body="Contact Name: $name\nCompany Name: $company\nReturn E-Mail: $email\n\nMessage:\n$message";
if (!isset($_POST["name"])
{
echo "Some of the Form Fields have been incorrectly filled in, please click <a href='#' onclick="history.back();">here</a> and try again."
}
if (!isset($email)
{
echo "Some of the Form Fields have been incorrectly filled in, please click <a href='#' onclick="history.back();">here</a> and try again."
}
if ($message == "Please type your message here.")
{
echo "Some of the Form Fields have been incorrectly filled in, please click <a href='#' onclick="history.back();">here</a> and try again."
}
mail($toaddr, $subject, $body, $headers);
header( "Location: http://www.domain.com/index.html" );
}
else
{
echo "Some of the Form Fields have been incorrectly filled in, please click <a href='#' onclick="history.back();">here</a> and try again."
}
?