Forked from furkanmustafa/html-php-date-picker.php
Created
February 19, 2018 20:23
-
-
Save baddot/4a63f0772e9834c376c22b12e4a664b5 to your computer and use it in GitHub Desktop.
Date Picker Select Generator for HTML & PHP
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 name="year"> | |
<option value="">Year</option> | |
<?php for ($year = date('Y'); $year > date('Y')-100; $year--) { ?> | |
<option value="<?php echo $year; ?>"><?php echo $year; ?></option> | |
<?php } ?> | |
</select> | |
<select name="month"> | |
<option value="">Month</option> | |
<?php for ($month = 1; $month <= 12; $month++) { ?> | |
<option value="<?php echo strlen($month)==1 ? '0'.$month : $month; ?>"><?php echo strlen($month)==1 ? '0'.$month : $month; ?></option> | |
<?php } ?> | |
</select> | |
<select name="day"> | |
<option value="">Day</option> | |
<?php for ($day = 1; $day <= 31; $day++) { ?> | |
<option value="<?php echo strlen($day)==1 ? '0'.$day : $day; ?>"><?php echo strlen($day)==1 ? '0'.$day : $day; ?></option> | |
<?php } ?> | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment