Forum Moderators: coopster
The best way to store dates in any database is the DATE format (yyyy-mm-dd). If you need the time as well, use the TIMESTAMP format (yyyy-mm-dd hh:mm:ss). The reason for this is you will be able to use the DATE and TIME functions for querying those types of columns.
$year = (isset [php.net]($_POST['year'])) ? $_POST['year'] : '';
$month = (isset($_POST['month'])) ? $_POST['month'] : '';
$day = (isset($_POST['day'])) ? $_POST['day'] : '';
if (checkdate [php.net]($month, $day, $year)) {
$sql = "INSERT INTO table (date) VALUES(CONCAT_WS('-', '$year', '$month', '$day'))";
}