Reputation: 37
I have a select box which when selected reloads the page, how can I make sure the select still holds the selected value after the page reloads?
Thanks
Upvotes: 1
Views: 173
Reputation: 2708
Actually thier is no way for catch the selected value after reloads the page. You can do it :
You can selected option by this way value test . e.g.
if(isset($_POST['select']) && $_POST['select']==2){ echo "<option value='2' selected>Second</option>"; }
Same thing you can do with other PHP GLobal variables.
Upvotes: 0
Reputation: 1620
Here already 2 options, there are probably many more:
<option selected>
in the select list programaticallySucces!
Upvotes: 1