quickstopman Posted May 20, 2007 Share Posted May 20, 2007 hey guys i wanna make it so in my users registration form, and in the edit profile page to check if the email is valid. what i mean is that it has to have @, and .com, .org, ect. address. can someone tell me how to do that?? thanks guys theres no rush on the reply Quote Link to comment https://forums.phpfreaks.com/topic/52181-solved-simple-email-check/ Share on other sites More sharing options...
pocobueno1388 Posted May 20, 2007 Share Posted May 20, 2007 <?php $email = "blah@blah.com"; if (ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$", $email)){ echo "Valid!"; } else { echo "Not Valid!"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/52181-solved-simple-email-check/#findComment-257354 Share on other sites More sharing options...
The Bat Posted May 20, 2007 Share Posted May 20, 2007 You should change the ereg function to eregi, otherwise someone can enter in an email address such as "JoeSmith@blah.com" and have it be invalid. Quote Link to comment https://forums.phpfreaks.com/topic/52181-solved-simple-email-check/#findComment-257370 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.