Last active
August 29, 2015 14:14
-
-
Save schmidt1024/6cb2aaf1237763bec726 to your computer and use it in GitHub Desktop.
select field for the last 100 years incl. age limit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select> | |
<option>year</option> | |
<?php | |
$range = 100; | |
$limit = 18; | |
$current = date('Y'); | |
$eldest = $current - $range; | |
$recent = $current - $limit; | |
foreach (range($recent, $eldest) as $year) | |
{ | |
echo "<option value=\"".$year."\">".$year."</option>"; | |
} | |
?> | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment