<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>send.php</title>
</head>
<body>
<?php
$EmailFrom = $_POST['EmailFrom'];
$owner = trim($_POST['owner']);
$apartment = trim($_POST['apartment']);
$block = trim($_POST['block']);
$names_friends_and_family = trim($_POST['names_friends_and_family']);
$arrival_date = trim($_POST['arrival_date']);
$departure_date = trim($_POST['departure_date']);
$comments = trim($_POST['comments']);
/// Validate
$message = "<h2>Error!</h2><h4>You need to fill in the following:</h4><ul>";
if($owner == ""){$message .= "<li><b>Owner</b> Not completed!"; $fail = "Y";}
if($apartment == ""){$message .= "<li><b>Apartment</b> Not completed!"; $fail = "Y";}
if($block == ""){$message .= "<li><b>Block</b> Not completed!"; $fail = "Y";}
if($names_friends_and_family == ""){$message .= "<li><b>Names friends and family</b> Not completed!"; $fail = "Y";}
if($arrival_date == ""){$message .= "<li><b>Arrival date</b> Not completed!"; $fail = "Y";}
if($departure_date == ""){$message .= "<li><b>Departure date</b> Not completed!"; $fail = "Y";}
if($fail == "Y")
{
$message .= "</ul>";
include("form.htm");
die();
}
$EmailTo = "mailadres@live.be";
$validationOK=true;
if (trim($EmailFrom)=="") $validationOK=false;
if (!$validationOK) {
echo "Error! E-mail was not sent. Please check your code.";
exit;
}
$Body = "";
$Body .= "Owner:\n$owner\n\n";
$Body .= "Apartment:\n$apartment\n\n";
$Body .= "Block:\n$block\n\n";
$Body .= "Names friends and family:\n$names_friends_and_family\n\n";
$Body .= "Arrival date:\n$arrival_date\n\n";
$Body .= "Departure date:\n$departure_date\n\n";
$Body .= "Comments:\n$comments\n\n";
$Subject = "From $EmailFrom";
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
if ($success){ echo "Success! Your e-mail was sent!";}
else { echo "Error! Your e-mail was not sent!";}
?>
</body>
</html>