PHP Tutorial : Valid email checking script
Jan 5, 2009 Short PHP Functions
Hi,
Do you have any newsletters, contact forms or other pages where you require an email address ? If so, did you ever thought that someone might type “asd”, “452″ and other dummy words instead of a valid email address? Huh, for that I built an email validation script which checks for those things.
<?php function validMail ($email,$link) { if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z\-\.]+$",$email)) { print "Email address appears to be invalid<br />"; print "Go back <a href=\"$link\" title=\"inapoi\">click aici</a>"; exit(); } } ?>
You will need to pass two arguments :
1) $email field
2) $link to go back if email is invalid
Right like here
<?php $email = "abcdef"; validMail($email, "complete-form.php"); ?>
Tags: check email, check valid email, email, email address validation, email checking, email checking script, email validation, mail check, valid email, valid email checking, valid mail


January 27th, 2009 at 8:09 pm
Great! Thank you very much!
I always wanted to write in my site something like that. Can I take part of your post to my blog?
Of course, I will add backlink?
Sincerely, Timur I. Alhimenkov
January 28th, 2009 at 3:27 am
Thanks but
Nope sorry you cannot take nothing because I want to keep my content fresh and unique to avoid google penalties.
February 5th, 2009 at 7:21 pm
Hi. Your site displays incorrectly in Firefox, but content excellent! Thanks for your wise words.
February 6th, 2009 at 2:31 am
Great to hear, on me site displays ok in all three tested browser : firefox, ie and opera!
February 9th, 2009 at 12:05 pm
Hi, cool site, good writing