Thanks again for all replies...
I've added this regex to my code. It seems to actually work!! Yesssss!
Along with reCAPTCHA, am I fairly good to go with this form?
$name = stripslashes($_POST['name']);
$email = $_POST['email'];
$location = stripslashes($_POST['location']);
$website = $_POST['website'];
$comments = stripslashes($_POST['comments']);
$ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
$to = "david.adams5280@yahoo.com";
$subject = "Comments from DavidRaleigh.net";
$message = "<b>Name:</b> $name<br>
<b>Email address:</b> $email<br>
<b>Location:</b> $location<br>
<b>Website:</b> $website<br>
<b>IP address:</b>$ip<br><br>
<b>Comments:</b> $comments
";
$from = $_POST['name'];
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= "From: $from" . "\r\n";
if (!empty($_POST['email'])) {
$email = ($_POST['email']);
} else {
$email = NULL;
echo 'You forgot your email address.';
}
if(!preg_match('/^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4])$/', $email)) {
echo 'Email address is invalid.';
exit();
}
if (!empty($_POST['comments'])) {
$comments = stripslashes($_POST['comments']);
} else {
$comments = NULL;
echo 'You forgot to add your message.';
}
if ($email && $comments) {
echo "Thank you for your comments $name.";
mail($to,$subject,$message,$headers);
}
?>
Thanks once again, folks!