Created
March 15, 2016 18:34
-
-
Save lenivene/4d91e9d9f43d219674fa to your computer and use it in GitHub Desktop.
Generate listing of years
This file contains hidden or 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 name="year"> | |
<?php | |
$max_years = 100; | |
for ( $id = 1, $year = date('Y'); $year > ( date('Y') - $max_years ); $year-- ) { | |
if( date('Y') - 2 == $year ){ | |
?> | |
<option selected>Selecione o Ano</option> | |
<?php } ?> | |
<option value="<?php echo $year; ?>" id="<?php echo $id; ?>"><?php echo $year; ?></option> | |
<?php $id++;} ?> | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment