Maison > Article > développement back-end > 利用php创建日期抉择框
利用php创建日期选择框
<form action="" method="post" > <?php $months = array (1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); $days = range(1,31); $years = range(2008,2018); echo '<select name="month" >'; foreach ($months as $key => $value) { echo "<option value=\"$key\">$value</option>"; } echo '</select>'; echo '<select name="day" >'; foreach ($days as $value) { echo "<option value=\"$value\">$value</option>"; } echo '</select>'; echo '<select name="year" >'; foreach ($years as $value) { echo "<option value=\"$value\">$value</option>"; } echo '</select>'; ?> </form>