Jump to content

editing profile select menu


dvayne

Recommended Posts

In a registration form of mine the user selects the state they live in with a drop-down menu.

In the 'Update' form I would like their previous choice to automatically display its selection.

 

For example if my profile displays "Arkansas" my update form should be already display "Arkansas" in the the select menu, but I keep getting 'None Selected'?

I can make the data display correctly using <input type='text' ... but can't get the select tag to work.

 

Any help is greatly appreciated!

Link to comment
https://forums.phpfreaks.com/topic/99625-editing-profile-select-menu/
Share on other sites

Please post what you have. The best way would be to set the value's of each option to a number

 

<option value="1">Arkansas</option><option value="2">Alabama</option>

 

Then, when they submit, get the value chosen, compare it to each value as you're generating the list, and if theres a match

add : selected="selected" : to the option parameters.

 

Bryan

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.