xcoderx Posted July 20, 2010 Share Posted July 20, 2010 ok why am i getting error here anyone can guess? all im trying to do is the fields should be numeric and length should be 10 along with 2 - $date = $_POST['!date']; if(strlen($date) < 10 || !is_numeric($date) !=1-1); $user_profile['id'] = $_POST['user_id']; { $error['date']='error'; } Link to comment https://forums.phpfreaks.com/topic/208332-help-with-date-validation/ Share on other sites More sharing options...
KevinM1 Posted July 20, 2010 Share Posted July 20, 2010 What are you trying to do with this part of your conditional: !is_numeric($date) !=1-1 ?? Link to comment https://forums.phpfreaks.com/topic/208332-help-with-date-validation/#findComment-1088773 Share on other sites More sharing options...
AbraCadaver Posted July 20, 2010 Share Posted July 20, 2010 What are you trying to do with this part of your conditional: !is_numeric($date) !=1-1 ?? Haha, yes. If $date is numeric then your condition says if !true which is false is not equal to 0. If $date is NOT numeric then your condition says if !false which is true is not equal to 0. Link to comment https://forums.phpfreaks.com/topic/208332-help-with-date-validation/#findComment-1088782 Share on other sites More sharing options...
waynew Posted July 20, 2010 Share Posted July 20, 2010 You should also check out the checkdate() function: http://php.net/manual/en/function.checkdate.php Link to comment https://forums.phpfreaks.com/topic/208332-help-with-date-validation/#findComment-1088810 Share on other sites More sharing options...
xcoderx Posted July 21, 2010 Author Share Posted July 21, 2010 sowi guys lol i was drun k and i dnt know wht the f i was doin with the 1=1 hahaha where as it should have been '-' if(strlen($date) < 10 || !is_numeric($date[0]) || !is_numeric($date[1]) || $date[2] != '-' thanks anyways guys :-) Link to comment https://forums.phpfreaks.com/topic/208332-help-with-date-validation/#findComment-1089242 Share on other sites More sharing options...
xcoderx Posted July 21, 2010 Author Share Posted July 21, 2010 btw im getting better day by day in php mysql yaya :-) Link to comment https://forums.phpfreaks.com/topic/208332-help-with-date-validation/#findComment-1089244 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.