I have this date select box (for months only )
echo "<form action=\"index.php\" method=\"GET\">\n";
echo "<table border=\"1\">\n";
echo "<th colspan=\"2\">View Other Months</th>\n";
echo "<tr>\n";
echo "<td>\n";
echo "<select name=\"months\">\n";
foreach ($months as $key => $val ) {
($key == date('m', time())) ? ($sel = " selected") : ($sel = "");
echo "<option value=\"".$key."\"$sel>".$val."</option>\n";
}
When i select a month earlier than the current month ( october so fa ), there is 10 added to the month. January become 11, February becomes 12 and so on.
I have tried to change it here:
echo "<form action=\"index.php\" method=\"GET\">\n";
echo "<table border=\"1\">\n";
echo "<th colspan=\"2\">View Other Months</th>\n";
echo "<tr>\n";
echo "<td>\n";
echo "<select name=\"months\">\n";
foreach ($months as $key => $val ) {
($key == date('m', time()-10)) ? ($sel = " selected") : ($sel = "");
echo "<option value=\"".$key."\"$sel>".$val."</option>\n";
}
But i haven't solved it yet.
Any ideas??