If you want pure PHP solution you could try to make the formular like this:
PHP Code:
<form method="POST">
Day:
<select name="day">
<?php for ($i = 1; $i <= 31; $i++) : ?>
<option value="<?= $i ?>"><?= $i ?></option>
<?php endfor ?>
</select>
Month:
<select name="month">
<?php for ($i = 1; $i <= 12; $i++) : ?>
<option value="<?= $i ?>"><?= $i ?></option>
<?php endfor ?>
</select>
Year:
<select name="year">
<?php for ($i = 1990; $i <= date('Y'); $i++) : ?>
<option value="<?= $i ?>"><?= $i ?></option>
<?php endfor ?>
</select>
<input type="submit" value="submit" name="submit" />
</form>
<?php
if (!empty($_POST)){
if (checkdate($_POST['month'], $_POST['day'], $_POST['year'])){
$timestamp = mktime(0, 0, 0, $_POST['month'], $_POST['day'], $_POST['year']);
$date = date('Y-m-d', $timestamp);
echo $date; // Your SQL query goes here
}
else {
echo 'Incorrect date format.';
}
}
?>
If you want a nicer solution then I recommend using jQuery UI datepicker http://jqueryui.com/demos/datepicker/ .
Bookmarks