xcoderx Posted July 13, 2010 Share Posted July 13, 2010 guys now how do i validate the email field and check if date entered is numeric? $email = $_POST['email']; if($email =="") { $error['email']='yes'; } $date = $_POST['date']; if($date =="") { $error['$date']='yes'; } if(count($error) ==0) { Link to comment https://forums.phpfreaks.com/topic/207643-how-would-i-validate-email-here/ Share on other sites More sharing options...
AbraCadaver Posted July 13, 2010 Share Posted July 13, 2010 I doubt that you want numeric because it would need to be all numbers with no separators, but: filter_var($email, FILTER_VALIDATE_EMAIL); //and is_numeric($date); Link to comment https://forums.phpfreaks.com/topic/207643-how-would-i-validate-email-here/#findComment-1085521 Share on other sites More sharing options...
xcoderx Posted July 13, 2010 Author Share Posted July 13, 2010 ah thats true but if users somehow enters alphabets then i must stop them how would i do that? somethin in the input field?. Link to comment https://forums.phpfreaks.com/topic/207643-how-would-i-validate-email-here/#findComment-1085524 Share on other sites More sharing options...
AbraCadaver Posted July 13, 2010 Share Posted July 13, 2010 ah thats true but if users somehow enters alphabets then i must stop them how would i do that? somethin in the input field?. It depends. You should really force a specific date format. You could use a javascript date picker or maybe use 3 fields (month, day, year) and check that they are valid. Link to comment https://forums.phpfreaks.com/topic/207643-how-would-i-validate-email-here/#findComment-1085529 Share on other sites More sharing options...
xcoderx Posted July 13, 2010 Author Share Posted July 13, 2010 solved thanks :-) javascript the solution. Link to comment https://forums.phpfreaks.com/topic/207643-how-would-i-validate-email-here/#findComment-1085530 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.