Forum Moderators: coopster

Message Too Old, No Replies

A good email validation?

NEW to PHP, please help

         

livetoride

2:26 pm on Jul 22, 2007 (gmt 0)



Hi,

I recently posted about my form and the response I got helped me, so I figured I would try again here.

I'm trying to set up a good email validation. It works with my one email address, but I have one I use for personal, rather than work, and it is like this: p.name@gmail.com. can someone tell me how to include the periods?

justgowithit

3:45 pm on Jul 22, 2007 (gmt 0)

10+ Year Member



How about....

if (preg_match("/^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]+\.[a-z]{2,4}$/", stripslashes(trim($_POST['email'])))) {
echo 'good';
} else {
echo 'bad';
}

... test it well ;)

livetoride

4:21 pm on Jul 22, 2007 (gmt 0)



thanks so much.