PDA

View Full Version : simple datecheck not working



spork
August 11th, 2002, 15:30
this little piece of code does not have the effect i intended it to have, in fact it does nothing, nothing is added to $errors even if there are errors in the date submitted... month and date comes from select elements and year is entered manually....



if (!empty($formvars["month[0]"]))
{
if (!empty($formvars["day[0]"]))
{
if (!checkdate($month[0], $day[0], $year))
$errors .= "Your birth date is not valid";
elseif (intval($formvars["year"]) < 1890)
$errors .= "Unfortunately, dead people canīt sign up for this service.";

} }

rapmaster
August 11th, 2002, 18:18
if (!checkdate($month[0], $day[0], $year)) {
$errors .= "Your birth date is not valid";
}
elseif (intval($formvars["year"]) < 1890) {
$errors .= "Unfortunately, dead people canīt sign up for this service.";
}




you forgot the {} braces.

spork
August 12th, 2002, 09:57
hehe, indeed i did... it was all clear to me when i woke up this morning... :D

spork
August 12th, 2002, 11:18
actually, it still does nothing...

bah... *looks at code again*

spork
August 12th, 2002, 12:45
ah, it did not appretiate the array within the array ($formvars["month[0]"])... works without it...