Im having difficulties figuring out how to do the following preg_match in php.
I have a HTML form where the user can enter his or hers birthdate by day, month & year.
How do i validate the following
Day: make sure it’s a number between 1 and 31, actually between 01 and 31
Month: make sure it’s a number between 1 and 12, actually between 01 and 12
Year: make sure it’s a number between 1800 and 2012, actually between 1800 and 2012
if (preg_match( ????? )) {
echo " SUCCESS";
} else {
echo " ERROR";
}
Thanks…
Checkdate needs 3 different parameters, for validating one input with preg_match, use pattern:
it validates correct date in style dd-mm-yyy and dd.mm.yyyy and dd/mm/yyyy and if you want, it also parses values out for each parameter