if (isset($_POST['Submit'])){
$pefect = 3;
$toggle = 3;
//validate
$name = $_POST['name'];
$email = $_POST['email'];
$comments = $_POST['comments'];
if ($name==NULL){
$toggle = $toggle-1;
echo "You did not input your name
\n";
}
if ($email==NULL || is_email($email)==0 ){
$toggle = $toggle-1;
echo "You have not entered in the correct email
\n";
echo "
";
}
if ($comments==NULL){
$toggle = $toggle-1;
echo "You did not input any comments please go back
\n";
}
//if everything not okay
if ($toggle != $perfect){
show_contact_form();
}
else {
echo "Your mail has been sent!
";
send_htmlmail($email,$name,$comments);
}
}
else {
//this is to make sure people dont submit things twice
show_contact_form();
}
include ("template/template_end.php");
function show_contact_form(){
echo "