I have a form which sends an email, and in my form validation, I want to make sure only one email address can be accepted. I'm fairly new to php and can't seem to find what I need via google and othe php manuals...because I'm not sure what to look for...
I have some code that checks for a proper email address, but I need to also check to make sure there is only one so that bots can't add extra email addresses.
Here is my code:
Code: Select all
$email_address = $_POST['email_address'];
function check_email($email_address, $optional)
{
if ( (strlen($email_address) == 0) && ($optional === true) ) {
return true;
} elseif ( ereg("[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+", $email_address) ) {
return true;
} else {
return false;
}
}
//Validate
if ( (! check_email($email_address, false))) {
$validationFailed = true;
}I also have a verification image working as well.
Spammers suck!!
Thanks!
ROB