Cant seem to get it to work. Here's the background info. - Have a select box which will highlight an option based on $num value. On pages that I can write the page title this is fine as I also just use $num=3, which tells the select box to highlight option 3.
However, I have a forum, and on the board index and topic pages, the page title is written once the user posts; therefore I cannot decide the page title. Upon implementing your code above the select box does not highlight the desired option. rather it is using the default 0.
<select size=1 id="s1" onchange="window.open(this.options[this.selectedIndex].value,'_top')">
<option value="/index.php" <?php echo ($num == 1)?"selected":""; ?>>Home</option>
<option value="/content/index.php#c2" <?php echo ($num == 2)?"selected":""; ?>>Nottinghamshire</option>