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 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 = "[email protected]"; if (ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)+$", $email)){ echo "Valid!"; } else { echo "Not Valid!"; } ?> 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 "[email protected]" and have it be invalid. Link to comment https://forums.phpfreaks.com/topic/52181-solved-simple-email-check/#findComment-257370 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.