Thank you in advance to anyone who can solve this for me.

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

10 Years
Discussion Span
Last Post by nav33n

First, let me say thank you for such rapid responses.

I apologize. I'm probably not explaining myself correctly.

I do not have any trouble updating the record with the select menu, what I can't make work is getting the select menu to be 'display' or be 'pre-selected' based on the users input that already lives on the db.
What happens is - when a users chooses to update their record, update.php is a form with all of their fields displayed 'pre-populated' - all but the drop-down menus. I keep getting value =0.

Thanks again.


Okay! I saw your other thread. Anyways, this is how you can make it work. Have an onchange event in your selectbox. When a value is selected, submit the page. (document.form.submit()). $_POST will have the value selected from the dropdown. Then check if it matches with each option value. If it matches, then echo "selected", or else, echo nothing.


Again, Thank you.

I'm afraid I understand a little of what you are suggesting to do.

I do not want the form to submit on change.
Can you explainhow to "Check if it matches". I'm doing U.S states (all 50). Would I have to do if /else statements for each?

I hope I am making clear what I am trying to do.


Okay. Can you post your code ? I need to see why your page showing the 'default value' instead of the selected value ?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.