}
function show_date_form($name, $date = null) {
- $past = 60;
- $future = 60;
- echo "<select name=\"$name\">\n";
- $now = date('Y-m-d', time());
- list($y, $m, $d) = explode('-', $now);
- $today = mktime(0, 0, 0, $m, $d, $y);
- if (isset($date)) {
- list($y, $m, $d) = explode('-', $date);
- $then = mktime(0, 0, 0, $m, $d, $y);
- if ($then < $today - 86400 * $past || $then > $today + 86400 * $future) {
- option($name, $date, date('l j F Y', $then), $date);
- }
- }
- else $date = $now;
- for ($i = -$past; $i < $future; $i++) {
- $then = $today + 86400 * $i;
- option($name, date('Y-m-d', $then), date('l j F Y', $then), $date);
- }
- echo "</select>\n";
- return;
- if (! isset($date)) $date = date('Y-m-d');
- list($y, $m, $d) = iso8601_to_ymd($date);
-
- echo "Year: <input name=\"$name" . "_y\" value=\"$y\" size=4 maxlen=4> ";
- echo "Month: <input name=\"$name" . "_m\" value=\"$m\" size=2 maxlen=2> ";
- echo "Day: <input name=\"$name" . "_d\" value=\"$d\" size=2 maxlen=2> ";
+ if (! isset($date)) $date = date('Y-m-d', time());
+ datepicker($name, $date);
}
function validate_postcode($postcode, &$outward = null, &$inward = null) {