Ereg question
| From: | Beauford | Date: | Sun, 30 Mar 2003 18:13:04 +0000 |
| Subject: | Ereg question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-141643@lists.php.net to get a copy of this message | ||
I am using ereg to validate the format of a date entry (mm/dd/yy), but if
the year ends in a 0, it is being stripped and as such produces an error. So
1990 would be 199. The dob is being inputted by a form....
Here is my code:
if (!ereg("^([0-9]{2})/([0-9]{2})/([0-9]{4})$", $formsave["dob"], $parts)) {
$error["dob"] = "*"; $message["dob"] = "Invalid date
format!";
$dob = " \"$parts[3]-$parts[2]-$parts[1]\"";
}
Thanks