Generate a dropdown with days of the month





10
Date Submitted Mon. Sep. 18th, 2006 5:05 AM
Revision 1 of 1
Helper nothingless
Tags forcodegrrl | forms | PHP
Comments 0 comments
The below code will generate a form dropdown for all the days of the month, with today's day selected. Handy for those date pickers!
<select name="start_day">
<?php
global $LOC;
$current_time_day = $LOC->decode_date('%d', $LOC->now);

for ($i = 1; $i <= 31; $i++) {
   echo "<option value='$i'";
if ($i == $current_time_day) { echo " selected='selected'"; }
   echo ">$i</option>
"
;
} ?>
</select>

Comments

There are currently no comments for this snippet.

Voting