Jump to content

[SOLVED] Months dropdown


denhamd2

Recommended Posts

Try this:

<?php
$out  = "<select name=\"month\">\n";
$out .= "<option value=\"\"></option>\n";

for ($i = 0; $i < 12; $i++) {
  $ts = mktime(0,0,0,(date('m') + $i),1);
  $month = date('m', $ts);
  $year  = date('Y', $ts);
  $out .= "<option value=\"$ts\">$month $year</option>\n";
}

$out .= "</select>\n";
?>

 

Untested, but the principle should be solid.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.