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 Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 19, 2011 Share Posted February 19, 2011 Clicky. Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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... Quote Link to comment 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. Quote Link to comment 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.