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. Quote Link to comment 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 Quote Link to comment 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. 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.