Forum Moderators: mack

Message Too Old, No Replies

PHP script for email validation

         

Livewirez

4:51 pm on Aug 9, 2003 (gmt 0)

10+ Year Member



Does anybody know where to find a php script (for idiots! ie me) that validates email addresses when entered into a form.

Any info would be appreciated
cheers

Livewirez

jatar_k

4:49 pm on Aug 10, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



if you are just looking to make sure it matches the pattern for emails you could use this

$pattern = '^([._a-zA-Z0-9-]){2,255}@([._a-zA-Z0-9-]){2,255}\.([a-zA-Z]){2,3}$';
if (!ereg ($pattern,$email)) {
echo "bad email";
}