Created
June 21, 2010 10:42
-
-
Save anonymous/446695 to your computer and use it in GitHub Desktop.
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
<?php | |
$date = '21/06/2010'; | |
$date_infos = explode('/',$date); | |
$jour = $date_infos[0]; | |
$mois = $date_infos[1]; | |
$annee = $date_infos[2]; | |
/* Affichage des jours */ | |
echo '<select name="date_jour">'; | |
for($i = 1 ; $i <= 31 ; $i++) { | |
echo ($i == $jour) ? | |
'<option value="'.$i.'" selected="selected">'.$i.'</option>' | |
: | |
'<option value="'.$i.'">'.$i.'</option>'; | |
} | |
echo '</select>'; | |
/* Affichage des mois */ | |
echo '<select name="date_mois">'; | |
for($i = 1 ; $i <= 12 ; $i++) { | |
echo ($i == $mois) ? | |
'<option value="'.$i.'" selected="selected">'.$i.'</option>' | |
: | |
'<option value="'.$i.'">'.$i.'</option>'; | |
} | |
echo '</select>'; | |
/* Affichage des années */ | |
echo '<select name="date_annee">'; | |
for($i = 1900 ; $i <= (int) date('Y') ; $i++) { | |
echo ($i == $annee) ? | |
'<option value="'.$i.'" selected="selected">'.$i.'</option>' | |
: | |
'<option value="'.$i.'">'.$i.'</option>'; | |
} | |
echo '</select>'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment