here's a function I use.
It returns true or false
/*****************************************
function : isValidEmail
description : Checks to make sure email address is valid format
return value: BOOL
parameters : 1
email = STRING:the email address
*****************************************/
function isValidEmail($email)
{
if (preg_match("/^[A-z0-9_\-\.]+@[A-z0-9_\-\.]+\.[A-z]+$/",$email)){
return(true);
} else {
return(false);
}
}//END function isValidEmail
if you use it, change your code to this:
if ($_POST['action'] == "subscribe" && isValidEmail($_POST['email']) ) {
do this;
} else {
do this;
}