Created
January 27, 2013 15:34
-
-
Save furkanmustafa/4648867 to your computer and use it in GitHub Desktop.
Date Picker Select Generator for HTML & PHP
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"> | |
<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> |
@DevJacobZhang, this one was just for a simple input. It's better to use some javascript date picker for that.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hello ! if month:3 day just have 29, how to write ? when user choice month ,day will change.