Forum Moderators: coopster
$mydate = (isset($_POST['mydate'])) ? trim($_POST['mydate']) : '';
// Make sure the supplied date is in a yyyy-mm-dd format; if so, then
// make sure the supplied date is a valid date. If either of the
// edits is not TRUE, we have an invalid date, handle accordingly:
if (!preg_match [php.net]("/^(\d{4})-(\d{2})-(\d{2})$/", $mydate, $date) ¦¦
!checkdate [php.net]($date[2], $date[3], $date[1])) {
// Bad date!
// Or, you could initialize to a good date:
// $mydate = date [php.net]('Y-m-d');
}