Posted on 2005-03-08
I have a form that posts to a php page to verify some data for me. What I wanted help with was the verification of a date. The the form suggests to enetr the date in the form dd-mm-yyyy on entry, but the field is not restricted to allow a formatted entry (as I don't know how to do this if it's possible). I want to check that that each part is within the valid range, and also that the whole string is not completely wrong.
I realise I can use the following:-
if (dateparts <= 31 && dateparts <= 12 && ....)
or similar to that, but will this handle errors if the user were to enter something silly for the date, such as:
January 6th 2000
I'm not worried about checking about invalid dates such as 30-02-2005. Just for completely incorrectly formatted data.
Thanks in advance,
P.S. Hope I am clear enough