$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$boat_id = $_POST['boat_id'];
$comments = $_POST['comments'];
$error_msg = "";
$msg = "";
if(!$name){
$error_msg .= "Your name \n";
}
if($name){
$msg .= "Name: \t $name \n";
}
if($phone){
$msg .= "Phone: \t $phone \n";
}
if(!$email){
$error_msg .= "Your email \n";
}
if($email){
if(!eregi("^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\._\-]+\.[a-zA-Z]{2,4}", $email)){
echo "\n
That is not a valid email address. Please return to the previous page and try again.\n
";
exit;
}
$msg .= "Email: \t $email \n";
}
if($boat_id){
$msg .= "YW# / Boat ID: \t $boat_id \n";
}
if(!$comments){
$error_msg .= "A Message \n";
}
if($comments){
$msg .= "\nComments: \t $comments \n";
}
$sender_email="";
if(!isset($name)){
if($name == ""){
$sender_name="Web Customer";
}
}else{
$sender_name=$name;
}
if(!isset($email)){
if($email == ""){
$sender_email="Customer@website.com";
}
}else{
$sender_email=$email;
}
if($error_msg != ""){
echo "You didn't fill in these required fields:
"
.nl2br($error_msg) .'
Please return to the previous page and try again.';
exit;
}
$mailheaders = "MIME-Version: 1.0\r\n";
$mailheaders .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$mailheaders .= "From: $sender_name <$sender_email>\r\n";
$mailheaders .= "Reply-To: $sender_email <$sender_email>\r\n";
mail("myersyachts@aol.com", "Custom Listings Message from __USERTITLE__", stripslashes($msg), $mailheaders);
header("Location: myersyachts_contact.php?sent=true");
?>