For another class assignment, I have created a form that uses regular expressions to validate the input. I have gotten this to work for first name, last name, and even email address, but I am having hard time with birth date. I am sure this is something simple, but I haven't been able to figure it out. This is the syntax I am using to try to validate input to a mm-dd-yyyy entry between years 1900-2005...
if (!eregi('^[1-12]+\-[1-31]+\-[1900-2005]+$', $bdate))
I just discovered another problem... I have the following line to validate lottery numbers (don't ask) and it works to validate that the value is numeric, and that it is no less than the alotted characters, but it will allow me to type all day in the field and it still validates.
if (!eregi('^[0-99]+\-[0-99]+\-[0-99]+\-[0-99]+\-[0-99]+\-[0-99]+$', $lottery))
I realize I could probably limit the form field to correct this, but that probably wouldn't be the cleanest way...
thanks,
Jim