Not showing the current month???
Posted: Sun Sep 03, 2006 1:37 am
My code that is below is not showing the current month. Can someone please tell me why and how I can fix it? Thanks in advance.
Code: Select all
$now = time();
$lastDay = date("t", $today);
$months = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$thisDay = date("j");
$thisMonth = date("M");
$thisYear = date("Y");
print "<select name=\"selectDay\" id=\"selectDay\">";
for($i=1; $i<=$lastDay; $i++)
{
$selStr = $i == $thisDay ? " selected=\"selected\"" : "";
print "<option value=\"$i\"$selStr>$i</option>";
}
print "</select>";
print "<select name=\"selectMonth\" id=\"selectMonth\">";
foreach($months as $v)
{
$selStr = $v == $thisMonth ? " selected=\"selected\"" : "";
print "<option value=\"$v\"$selStr>$v</option>";
}
print "</select>";
print "<select name=\"selectYear\" id=\"selectYear\">";
for($i=$thisYear; $i<$thisYear+30; $i++)
{
$selStr = $i == $thisYear ? " selected=\"selected\"" : "";
print "<option value=\"$i\"$selStr>$i</option>";
}
print "</select>";