0

このコードは、当月から始まる 12 か月すべてを表示するのに問題なく機能することを除けば、月の最終日に問題が発生し続けます。月の最後の日に、一部の月の複製が表示され、他の月はまったく表示されません。どんな助けでも大歓迎です。ありがとう。

<select id="month" name="month">


<?php

//lists months

    for ($i = 0; $i <= 11; ++$i) 
        {
            $time = strtotime(sprintf('+%d months', $i));
            $value = date('m', $time);
            $label = date('F', $time);

//if month is set stay on that month

            if($month==$value)
                { printf('<option value="%s" selected="selected">%s</option>' , $value, $label);
                }
            else
                {printf('<option value="%s">%s</option>', $value, $label);}
        }

?>

//first month shows instead of blank

    $("#target option:first")

</select>
4

2 に答える 2