Ok. I'm either going crazy or I've just been plain sitting here to long.
I have this simple loop to build a select field showing page numbers. But for some weird reason. its compeltely ignoring the SELECTED copy that should be written into the option field.
Code:
$page = (!isset($_GET['page'])) ? 1 : $_GET['page'];
$pagenumbers = "";
$pagenumbers .= " <form><select name='menu1' onchange=\"MM_jumpMenu('parent',this,0)\">\n";
for($i = 1; $i <= $total_pages; $i++) {
$pagenumbers .= " <option value='" . $_SERVER['PHP_SELF'] . "?a=" . $ashort. "&page=" . $i . "'";
if($page == $i) $pagenumbers .= " selected";
$pagenumbers .= ">Page $i</option>\n";
}
$pagenumbers .= " </select></form>\n";
I've checked al values for $page, and $i, ran and echo test to see what its doing and still nothing. When I view the source on the page I see:
Code:
<select name="menu1" onchange="MM_jumpMenu('parent',this,0)">
<option value="index.php?a=test&page=1">Page 1</option>
<option value="index.php?a=test&page=2">Page 2</option>
<option value="index.php?a=test&page=3">Page 3</option>
<option value="/index.php?a=test&page=4">Page 4</option>
</select>
Am I going nuts. why would it not write in the selected. there is definately a match when it sees 'page' number in the URL string.
Whats weird is that its writing "&" and it also converted my single quotes to double (but maybe thats normal)....
Please bail me out of this ridiculous hole I'm in