Skip to content

Instantly share code, notes, and snippets.

@jgarciaruiz
Created March 26, 2019 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgarciaruiz/64091b703e66641186377dd4a807fa56 to your computer and use it in GitHub Desktop.
Save jgarciaruiz/64091b703e66641186377dd4a807fa56 to your computer and use it in GitHub Desktop.
<select name="month" id="month" class="select_month">
<?php
for ($i = 1; $i <= 12; $i++){
$monthNumber = ($i < 10) ? '0'.$i : $i;
$monthStr = date('F', strtotime("$currentYear-$monthNumber"));
echo '<option value="'.$monthNumber.'"';
if ($i == $currentMonth){
echo ' selected="selected"';
}
echo '>'.$monthStr.'</option>';
}
?>
</select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment