I wrote one .php file for a person to add a record to a database. One of the columns is "prod_loc" which is the location that they're in. In the form that the user uses to enter the info, I use a pulldown menu like this:
Production Location:
<select name="prod_loc">
<option value="NY">New York City</option>
<option value="LA">Los Angeles</option>
<option value="NJ">New Jersey</option>
<option value="FL">Miami</option>
<option value="IL">Chicago</option>
</select>
I want to create another php file where I, or another administrator, can edit the record that the user has entered in a similar form. I'm trying to figure out what is the easiest way for me to pre-select the menu option the user chose.
For example, lets' say the user selected Miami. How would I get the php file to automatically choose Miami in the menu when the administrator calls up the record on the site to edit it? I know I need to use the "selected" option in the option tag to make it so, but how to I get php to make it automatically come up that way in the html like this:
Production Location:
<select name="prod_loc">
<option value="NY">New York City</option>
<option value="LA">Los Angeles</option>
<option value="NJ">New Jersey</option>
<option value="FL" selected>Miami</option>
<option value="IL">Chicago</option>
</select>
I hope I explained that right. 🙂