I have attempted to add the date validation by Vip Malixi in this thread http://www.phpbuilder.com/forum/read.php3?num=2&id=129627&thread=127782 to the validation class in this article http://www.devshed.com/Server_Side/PHP/FormValidatorClass/page12.html. The validation of date format MM/DD/YY validates, however past dates are validated a true when they should not. Any help is appreciated.
Code Fragment:
//Check for a valid future date
function isValidDate($field, $msg)
{
$value = $this->getValue($field);
$strData = strtok($value, "/");
$intCount = 1;
while ($strData)
{
if ($intCount == 1)
{
$tmpmonth = $strData;
}
if ($intCount == 2)
{
$tmpday = $strData;
}
if ($intCount == 3)
{
$tmpyear = $strData;
}
$intCount = $intCount + 1;
$strData = strtok("/");
} // while()
if (checkdate($tmpmonth,$tmpday,$tmpyear))
{
return true;
}
else
{
$this->errorList[] = array("field" => $field, "value" => $value, "msg" => $msg);
return false;
}
}