monkeybidz Posted October 2, 2007 Share Posted October 2, 2007 How would i run a check in my datacheck page to see if the user entered an email address in a form text field? if(empty($email_address) || - NOT VALID EMAIL STUFF HERE -){ $msg[] = $error12; } Link to comment https://forums.phpfreaks.com/topic/71584-solved-validate-an-email-form-text-filed/ Share on other sites More sharing options...
MadTechie Posted October 2, 2007 Share Posted October 2, 2007 this will check if is a valid syntax, but your need to email them to see if the email is their valid email, or check the domain to see if its a valid domain.. <?php if ( !preg_match('/^\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b$/i', $email_address) ) { $msg[] = $error12; } ?> EDIT: '[email protected]' = valid (without quotes) '[email protected] ' = invalid (without quotes) (note the space at the end '' = invalid Link to comment https://forums.phpfreaks.com/topic/71584-solved-validate-an-email-form-text-filed/#findComment-360384 Share on other sites More sharing options...
monkeybidz Posted October 2, 2007 Author Share Posted October 2, 2007 Outstanding! Thanks a bunch. Link to comment https://forums.phpfreaks.com/topic/71584-solved-validate-an-email-form-text-filed/#findComment-360412 Share on other sites More sharing options...
MadTechie Posted October 2, 2007 Share Posted October 2, 2007 welcome remember it only check if its a valid email "format", someone can always put bill.gates@dumba__e.com Link to comment https://forums.phpfreaks.com/topic/71584-solved-validate-an-email-form-text-filed/#findComment-360414 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.