Rate this script:  I Love it  /   I Hate it

Generate a dropdown with months in a year


Code


<select name="start_month">
<?php
global $LOC;
$current_time_m = $LOC->decode_date('%m', $LOC->now);

for ($i = 1; $i <= 12; $i++) {
   echo "<option value='$i-'";
if ($i == $current_time_m) { echo " selected='selected'"; }
$month_text = date("F", mktime(0, 0, 0, $i+1, 0, 0, 0));
   echo ">$month_text</option>
"
; } ?>
</select>
 

 

 
Generate a dropdown with months in a year scripts | Generate a dropdown with months in a year snippet | Generate a dropdown with months in a year example | Generate a dropdown with months in a year tutorial | Generate a dropdown with months in a year code