Created
April 3, 2015 04:54
-
-
Save prio101/5173dfe5d03c5acf98ea to your computer and use it in GitHub Desktop.
Year Option maker in select form.
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="pickYear"> | |
| <option value="1980"<?php echo $pickYear == '1980' ? 'selected' == "selected" : '' ?>> Year :</option> | |
| <?php | |
| for ($i=date('Y'); $i >= 1980 ; $i--) { | |
| $selected = '' ; | |
| if($pickYear == $i ) $selected = ' selected="selected"' ; | |
| print('<option value="'.$i.'"'.$selected.'>'.$i.'</option>'."\n"); | |
| // echo $i.'<br/>'; | |
| } | |
| ?> | |
| </select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment