Page 1 of 1

Dynamic Select Box

Posted: Fri May 21, 2004 12:37 am
by ankurdave
Dear Friends

I have a simple problem that i haev a select box in which 5 values 1,2,3,4,5 and the formation is

Code: Select all

<option>Select Rank</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
so wheh i select the rank so the query is fired for the selected rank. and result is displayed in the same page because the action is

Code: Select all

$PHP_SELF
the result is shown to me but in select box i always get the first line "select Rank" and i want it display the selected value in the select box and will changE when i refresh it or change it for the next query.

Because currently it is looking odd that the value is not shown in the select box and query is fired.

Please Help Me

Posted: Fri May 21, 2004 1:03 am
by feyd
use something similar to:

Code: Select all

<option<?= ((isset($_REQUEST['rank']) && $_REQUEST['rank'] == 2)?" selected":"") ?>>2</option>