PHP Email Validation Function Script Snippet Check Correct Emails
php email validation function script snippet check correct emails
php, email, validation, function, script, snippet, check, correct, emails
PHP Email Validation Function Script Snippet Check Correct Emails
Post Description: php email validation function script snippet check correct emails
POST# 1062
Posted On: Fri Feb 29, 2008 12:01 pm
web hosting
Topic: PHP Email Validation Function Script Snippet Check Correct Emails
thanks to www.webune.com for helping us with this questions.



i needed a function or class to check on my user's email to verify that the emails address they were providing was correct. so here is a useful email verification function.



this function just checks that the format of the email is correct:



function check_email($email) {

$validation = TRUE;
if(!eregi("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,4})$", $email)) {
$validation = FALSE;
}
return $validation;
}




hope this helps



USAGE:
if(!check_email($mail)) { 

$error .= "EMAIL - The Email You Provided Is not Valid";
}


Share:
BBCODE:
HTML Code:


Tue Mar 11, 2008 10:38 am
1
Max Matrix
Reply #1782
great job hommie, came in just handy.
thanx.

What do you think?

* name:  

* email:  

* Please enter comments:


Receive Replies on my Comments
(An email will be sent to you when someone replies to your comments)

Add image to comments
yes no             upload