hanlonj Posted September 27, 2006 Share Posted September 27, 2006 Hi,I want to check that email addresses entered into my form have some letters or numbers before the "@"and then comes a "." and then some letters e.g. ".net" or ".com" etc.I think I have to use the "ereg" function? Can anyone supply a generic example?ThanksJohn Quote Link to comment Share on other sites More sharing options...
AndyB Posted September 27, 2006 Share Posted September 27, 2006 [code] if (!$email) { $err.= "Please provide your email address<br/>"; } if ($email) { if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { $err.= $email. " is not a valid email address.<br/>"; } } [/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.