|
hi ,
I followed a procedure from a website to create a form ..but the validation is not working ..it ignores to check the required feild and just sends the confirmation mail ..what could be the reason ?....pls help..my code :
<?
session_start();
function checkOK($field)
{
if (eregi("\r",$field) || eregi("\n",$field)){
die("Invalid Input!");
}
}
$name=$_POST['name'];
checkOK($name);
$email=$_POST['email'];
checkOK($email);
$telephone=$_POST['telephone'];
checkOK($telephone);
$address=$_POST['address'];
checkOK($address);
$comments=$_POST['comments'];
checkOK($comments);
$to="userid@domain.name";
$message="$name just filled in your comments form. They said:\n$comments\n\nTheir e-mail address was: $email and telephone:$telephone with Address as:$address";
if(mail($to,"Comments From Your Site",$message,"From: $email\n")) {
echo "Thanks. your request has been received.";
} else {
echo "There was a problem sending the mail. Please check that you filled in the form correctly.";
}
?>
thanks
|