What I am trying to do is to alter which option for a drop-down to be selected.
I’m working on a page to modify entries into a database and I have a few entries I like to keep locked down to a pre-determined options. I can grab the value that it’s supposed to be from the database and I want that value to be selected from the drop down menu.
Is there a way to do this other than using an if statement or case statement to create html code to set the selected value?
Not sure if this is what you mean (I’m guessing that you have a lot of values and don’t want to write a lot of if statements or cases), but, if you’re pulling all of the options from the database (or store them in an array) you could run through them using foreach and compare with the default value that you want…