Validate Form Emails
Ever notice how when you register at certain websites, and you do not put in your correct email, by accident or just because, and the website displays an error because of that.
Well you can do that to. This function just checks the email using RegEX. Basically what this function does it check to make sure each letter/number is in the correct place it should be and that there is a.. @ . in the email.
You would use it like this.. example:
CODE
<?php
validateEmail($email);
?>
Any questions, feel free to use the contact page.
Now we have our final code.
CODE
<?php
function validateEmail($email){
if(ereg("^[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*@([_a-zA-Z0-9-]+.)*[a-zA-Z0-9-]{2,200}.[a-zA-Z]{2,6}$", $email ) ){
return true;
} else {
return false;
}
}
?>
Thursday October 18, 2007 | http://www.totaldream.org/article/130-validate_form_emails.html