I have a button on a form that when you click it it reloads the page and adds up some prices and displays the total depending on what you selected in some pull down menus. But when the page reloads the pull down menus go back to the default selection. How could I make it so that on reload they stay the same as previously selected? Thanks!
Basically you need to add "SELECTED" to the <OPTION> tag corresponding to the currently-select VALUE, if any. This is pretty easy to do in PHP, but the code can get messy.
Here's the most compact way I know of doing it without using functions (which I don't have time to go into). Say the value is stored in $value. Then for each <OPTION> tag, you need to add code that prints "SELECT" if the value for that tag matches $value, or "" (nothing) if it doesn't:
Yea, that is excactly how I did it. It just looked really messy and since there is a ton of code it makes the page load longer. I thought there just might be a easier way to do it. Thanks any ways.
Bookmarks