Collegeboox Posted February 19, 2011 Share Posted February 19, 2011 does anyone have code for checking to make sure an email address is typed in correct Link to comment https://forums.phpfreaks.com/topic/228211-email-check/ Share on other sites More sharing options...
Pikachu2000 Posted February 19, 2011 Share Posted February 19, 2011 Clicky. Link to comment https://forums.phpfreaks.com/topic/228211-email-check/#findComment-1176818 Share on other sites More sharing options...
Collegeboox Posted February 19, 2011 Author Share Posted February 19, 2011 I know I can google it, I have done it before I am just confused by what google gives me. Which is why I resorted to coming on here and looking for additional help. Link to comment https://forums.phpfreaks.com/topic/228211-email-check/#findComment-1176830 Share on other sites More sharing options...
Pikachu2000 Posted February 19, 2011 Share Posted February 19, 2011 Then explain what part of it has you confused, or ask a specific question about it. When you ask a question like the one in the OP, that's about the best answer for it. Link to comment https://forums.phpfreaks.com/topic/228211-email-check/#findComment-1176836 Share on other sites More sharing options...
Collegeboox Posted February 19, 2011 Author Share Posted February 19, 2011 I guess I am just looking for a wording for php code that checks to make sure @ sign is there...( i do not even know how to check to make sure the input is a number) For instance I have another form where they have to enter a phone number and I have no way of checking whether they enter 10 digit number or 10 letters... Link to comment https://forums.phpfreaks.com/topic/228211-email-check/#findComment-1176837 Share on other sites More sharing options...
Joshua F Posted February 20, 2011 Share Posted February 20, 2011 if(preg_match('/^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$/', $_POST['email1'], $matches) && strlen($matches[0]) === strlen($_POST['email1'])) Could be used like.. if(preg_match('/^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$/', $_POST['email1'], $matches) && strlen($matches[0]) === strlen($_POST['email1'])){ //codes to submit registeration } else { echo 'Your email isn't valid'; } Of course, you'll have to edit the variables to match yours. Link to comment https://forums.phpfreaks.com/topic/228211-email-check/#findComment-1176996 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.