phpretard Posted September 11, 2008 Share Posted September 11, 2008 I am trying to vslidate a date format to this - MM-DD-YYY The catch is that the date is submitted like this: <input name='LICEXP[$i]' value='$LICEXP[$i]'> There can be up to 4 dates. Here's my current code: $LICEXP=$_POST['LICEXP']; if (!ereg ("([0-9]{2})-([0-9]{2})-([0-9]{4})", $LICEXP)) { echo"error"; } It just echo error for erthang? Any help... I have searched but can't find. So here I am. Link to comment https://forums.phpfreaks.com/topic/123833-date-validation/ Share on other sites More sharing options...
dezkit Posted September 11, 2008 Share Posted September 11, 2008 <?php $LICEXP=$_POST['LICEXP']; if (!ereg ("([0-9]{2})-([0-9]{2})-([0-9]{4})", $LICEXP)) { echo "error"; } else { echo "correct."; } ?> Welcome to PHP Link to comment https://forums.phpfreaks.com/topic/123833-date-validation/#findComment-639367 Share on other sites More sharing options...
phpretard Posted September 11, 2008 Author Share Posted September 11, 2008 I appreciate the quick response but this code validates all the posts as one. There could be up to 4 and it is posted as an array. Link to comment https://forums.phpfreaks.com/topic/123833-date-validation/#findComment-639371 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.