bal bal Posted March 25, 2009 Share Posted March 25, 2009 hi I have got a form with name, email address and choose the pet from the list (cat or dog). How can I do the form validation with PHP, if anyone put the wrong name or invalid email address and don't choose anything from the pet list? please help me... thanks Quote Link to comment https://forums.phpfreaks.com/topic/151077-validate-email-address/ Share on other sites More sharing options...
Brian W Posted March 25, 2009 Share Posted March 25, 2009 http://www.webcheatsheet.com/php/regular_expressions.php#match On that page, a little below the "Matching Patterns" header, there is info on validating email address. As for validating whether other fields where completed, you'll need to do a check like if(trim($_POST['pet']) <= ""){ $error = "Please pick a pet"; } Quote Link to comment https://forums.phpfreaks.com/topic/151077-validate-email-address/#findComment-793654 Share on other sites More sharing options...
Maq Posted March 25, 2009 Share Posted March 25, 2009 Go to the Regex Section of this forum (a child forum of PHP Help) and search "email". Here's one that you might find useful: http://www.phpfreaks.com/forums/index.php/topic,234317.0.html Quote Link to comment https://forums.phpfreaks.com/topic/151077-validate-email-address/#findComment-793656 Share on other sites More sharing options...
bal bal Posted March 25, 2009 Author Share Posted March 25, 2009 http://www.webcheatsheet.com/php/regular_expressions.php#match On that page, a little below the "Matching Patterns" header, there is info on validating email address. As for validating whether other fields where completed, you'll need to do a check like if(trim($_POST['pet']) <= ""){ $error = "Please pick a pet"; } thanks a lot mate.... Quote Link to comment https://forums.phpfreaks.com/topic/151077-validate-email-address/#findComment-793660 Share on other sites More sharing options...
yami007 Posted March 25, 2009 Share Posted March 25, 2009 for the mail verification you can go here ==> http://www.sitepoint.com/article/users-email-address-php/ it is very useful Quote Link to comment https://forums.phpfreaks.com/topic/151077-validate-email-address/#findComment-793671 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.