Tuesday 15 June 2010

regex - html and php date input field -


I'm trying to figure out how to create an html input box for this type of date:

YYYY-MM-DD

I was wondering if I have a better way of manually doing something like this, and after that - the separator was YYYY Separation of MM-DD

After entering the user's date of birth, I am using regex to perform some assumptions so that it is safe Damage possible that it is more than 21.

  & lt; Label for = "dub" & gt; Age (YYYY-MM-DD) & lt; / Labels & gt; & Lt; Input id = "datfbrough" type = "text" name = "age" maximum length = "10" /> gt; & Lt; Span & gt; * & Lt; / Span & gt; & Lt; Br / & gt;  

This is my regex for the date which will be inside the checkdate function on the php side:

  return preg_match ('/ (\ d {4}) - (\ d {2}) - (\ d {2}) / ', $ date;  

Set the date that it only takes input from more than 21 users. It's not right now.
date date = '1974-12-03';

= 21) {back true;} other {return false;}} else {resonance 'something in your age input Is going wrong ';}

This will verify that the user is equal to 21 years of age


No comments:

Post a Comment