Skip to content

Instantly share code, notes, and snippets.

@schmidt1024
Last active August 29, 2015 14:14
Show Gist options
  • Save schmidt1024/6cb2aaf1237763bec726 to your computer and use it in GitHub Desktop.
Save schmidt1024/6cb2aaf1237763bec726 to your computer and use it in GitHub Desktop.
select field for the last 100 years incl. age limit
<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