note 72050 deleted from function.checkdate by nlopess
| From: | nlopess@php.net | Date: | Sun, 31 Dec 2006 00:17:56 +0000 |
| Subject: | note 72050 deleted from function.checkdate by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-121122@lists.php.net to get a copy of this message | ||
Note Submitter: tjo44 at hotmail dot com
----
If you don't want to double check for empty fields and THEN whether the date is correct use the
following:
<?php
if ( checkdate( (int)$_POST['month'], (int)$_POST['day'],
(int)$_POST['year'] ) )
{
echo 'Correct date found.';
}
else
{
echo 'Incorrect date, or missing fields (which result in 0 due to the (int) in front of the
variable) found.';
}
?>