I’m trying to update the user_pref column within my html form.
I have a drop down which looks like this (it works fine):
User pref: <select name="user_pref" size="1" id="user_pref">
<option value="BLUE">Blue</option>
<option value="RED">Red</option>
<option value="YELLOW">Yellow</option>
<?php echo htmlentities($user_pref, ENT_COMPAT, 'utf-8'); ?></select>
I want to be able to set the default value to the value the user already has in the user_prefcolumn in MySQL. So, for example ,if user A has "Yellow" in their user_pref then I want to display "Yellow" when I’m updating that user’s preference.
Can anyone please help me with this?
This is the basic idea… you’ll have to adapt it to fit your needs…