don’t think it’s that since you would still get an email.
Here’s a contact form script I use a lot so I know it works great feel free to use it it has validation when there’s an error it adds it to an array then loops through all errors and show’s them.
at the least it might give you some ideas
[php]
//This code runs if the contact form has been submitted
if (isset($_POST[‘maincontsubmit’]))
{
// check feilds are not empty
$name = trim($_POST[‘name’]);
if (strlen($name) < 3) {
$mainerror[] = ‘Name Must be more then 3 charactors.’;
}
if (strlen($name) > 20) {
$mainerror[] = ‘Name Must be less then 20 charactors.’;
}
// check for valid email address
$email = $_POST[‘email’];
$pattern = ‘/^[^@]+@[^\s\r\n’";,@%]+$/’;
if (!preg_match($pattern, trim($email))) {
$mainerror[] = ‘Please enter a valid email address’;
}
// check feilds are not empty
$message = trim($_POST[‘message’]);
if (strlen($message) < 3) {
$mainerror[] = ‘Message Must be more then 3 charactors.’;
}
// if valadation is okay then carry on
if (!$mainerror ) {
//send email
$to = ‘[email protected]’;
$subject = “Contact form”;
$body = “on “.date(‘M j, Y’).” Information from contact form: \n\n Name: $name \n\n Email: $email \n\n Message: \n\n $message \n\n”;
$additionalheaders = “From: <$email>\r\n”;
$additionalheaders .= “Replt-To: $email”;
if(mail($to, $subject, $body, $additionalheaders))
{
$_SESSION[‘psuccess’] = ‘Message sent successfully’;
header('Location: '.$_SERVER[‘HTTP_REFERER’]);
exit();
}
} // end valadation
}// end submit
//show any errors
if (!empty($mainerror))
{
$i = 0;
while ($i < count($mainerror)){
$showError.= “<div class=“msg-error hidethis”>”.$mainerror[$i]."";
$i ++;}
$output.= $showError;
}// close if empty errors
$cmessage = ‘’;
if($_SESSION[‘psuccess’] != ‘’) {
$cmessage = ‘
’.$_SESSION[‘psuccess’].’
’;
$_SESSION[‘psuccess’] = ‘’;
}
if($_SESSION[‘perror’] != ‘’) {
$cmessage = ‘
’.$_SESSION[‘perror’].’
’;
$_SESSION[‘perror’] = ‘’;
}
$output.= $cmessage;
$output.= “<form action=”" method=“post”>\n";
$output.= “
Name:<input name=“name” type=“text” maxlength=“20” value=”$name"/>
\n";
$output.= "
Email:<input name=“email” type=“text” maxlength=“255” value="$email"/>
\n";
$output.= “
Message:
<textarea name=“message” cols=“50” rows=“10”>$message
\n”;
$output.= “
<input type=“submit” name=“maincontsubmit” value=“Send Message” />
\n”;
echo $output;[/php]