Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Remembering <select> box value



9:57 am on Sep 2, 2009 (gmt 0)

10+ Year Member

I have 2 <Select> boxes

The 1st one is populated upon page load (PHP)
The 2nd one is populated via javascript (no page reload) depending on the 1st select box value.

Upon submit the page will display a preview of the user inputs, with 2 submit buttons [send] and [edit]

My problem is if the user choose to edit, how can I make it that 2nd select box remember its value since after a page reload the 2nd select box doesnt have any contents (options),

Adding options to the 2nd select box is triggered by the 1st select box hence the following code is not possible.

<option value="value_here>" selected>Text Here</option>

note : The 2 select boxes pulled values from a DB table.


12:37 pm on Sep 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Try including an input type=hidden with no value on initial load, save result of second selection there, hopefully it will still be there on page reload.


2:23 pm on Sep 2, 2009 (gmt 0)

10+ Year Member

Stuff the values in the querystring?

Featured Threads

Hot Threads This Week

Hot Threads This Month