• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

simple datecheck not working

spork

New Member
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....

PHP:
	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.";

	}	}
 
PHP:
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.
 
ah, it did not appretiate the array within the array ($formvars["month[0]"])... works without it...
 
Back
Top