ashishrathore Posted March 16, 2006 Share Posted March 16, 2006 hi,i know the validation of an email-id using JAVAScriptbut right now i am in a circumstances in which i have to validate email-id inside a php page using PHP code (and not the JAVASCRIPT)..can u help me in that plz?-ashish Link to comment Share on other sites More sharing options...
scott100 Posted March 16, 2006 Share Posted March 16, 2006 You should ask google such questions. insert into search box "php email validation"You will find the code you need on this page: http://www.zend.com/zend/spotlight/ev12apr.phpuse the eregi() function Link to comment Share on other sites More sharing options...
user4fun Posted March 17, 2006 Share Posted March 17, 2006 I am not sure if this is what you are looking for but ooh wellthere it goes $status = "OK"; $msg=""if (!stristr($em,"@") OR !stristr($em,".")) {$msg="Your email address is not correct<BR>";$status= "NOTOK";} if($status=="OK"){ echo "your submitted email address is $The email variable if you need it<br>"; $link = mysql_connect(" l", " ", " ");// incase you are using sql mysql_select_db("table_name"); $sql = "INSERT INTO table_name VALUES (' ')";$query=mysql_query($sql); echo "<center><b>THANK YOU</b> </center><br>"; echo "<center>WE HAVE YOUR EMAIL ADDRESS<br>"; } else {echo "<center>$msg </center>"; include '/inc/go_back.inc'; //html file showing a link to try again}?> </body></html> I HOPE I HELPED Link to comment Share on other sites More sharing options...
mani_ Posted March 23, 2006 Share Posted March 23, 2006 try this <?phpfunction checkEmail($email) { $pattern = "/^[A-z0-9\._-]+" . "@" . "[A-z0-9][A-z0-9-]*" . "(\.[A-z0-9_-]+)*" . "\.([A-z]{2,6})$/"; return preg_match ($pattern, $email);}if(checkEmail($your_email_address_to_be_validate)){ echo "Correct Email";}else{ echo "You have entered invalid email address";}?> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now