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; } Quote 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: 'freak@hotmail.com' = valid (without quotes) 'freak@hotmail.com ' = invalid (without quotes) (note the space at the end '' = invalid Quote 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. Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.