Hi, I have a user update page in PHP where the user can update their personal information. At registration and the update page, I use a dropdown menu for the state like so:
print '<td width="160"><p align="right">State</td>';
print '<td width="600"><p align="left"><select name="state">';
print '<option value="0" selected="selected">Select Your State</option>';
print '<option value="AL" selected_AL>Alabama</option>';
print '<option value="AS" selected_AS>American Samoa</option>';
print '<option value="AK" selected_AK>Alaska</option>';
I am able to return the data from the stored database fine, but the problem I am having is getting the dropdown menu to change to the retrieved state as it's selection. For example, Alabama would be stored in my database as AL. How do I make it so when AL is returned for the user from the stored info in the database, the dropdown menu is set for Alabama instead of "Select Your State"?
Thanks for any help with this PHP problem. It is appreciated.
return stored state in dropdown menu on user update page
Moderator: General Moderators
-
scvinodkumar
- Forum Newbie
- Posts: 2
- Joined: Thu Jun 11, 2009 2:30 am
Re: return stored state in dropdown menu on user update page
whether the states are coming from database? i mena the dropdown menu entry
Re: return stored state in dropdown menu on user update page
The dropdown menu itself is in the HTML, the only thing being returned by the database is the state such as AL. I need to know how to code it so when the state is returned, I can set the HTML dropdown menu to show the proper state selected.