Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dropdown Menus staying selected

Status
Not open for further replies.

Mark2K

MIS
Oct 11, 2000
50
GB
Hi,

I have a web page that uses a dropdown menu to allow the user to select some pre-defined views for a database.

My problem is, when I select a view, the page refreshes, shows what it is ment to, but the dropdown menu goes back to the first item.

Is there anyway to keep the dropdown menu on the view the user selected?

Many Thanks

Mark2k
 
I assume you are using some sort of server-side scripting, what you will want to do is check the form value as you write each option, and if the form value is equal to the value for the option your writing, add selected to it:
Code:
<option value=&quot;4&quot; selected> Four! </option>

If you specify the server-side language I might be able to provide a meaningful example (if needed).
-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
 
Hi Tarwn,

Thanks for your answer, I'm using PHP with the code for the menu in a seperate include file.

Mark2k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top