Populate default MYSQL value in a html Dopdown list

harveygorilla

New Member
I'm trying to update user_pref column within my html form.I have a drop down which looks like this (it works fine)\[code\]User pref: <select name="user_pref" size="1" id="user_pref"><option value="http://stackoverflow.com/questions/14586040/BLUE">Blue</option><option value="http://stackoverflow.com/questions/14586040/RED">Red</option><option value="http://stackoverflow.com/questions/14586040/YELLOW">Yellow</option><?php echo htmlentities($user_pref, ENT_COMPAT, 'utf-8'); ?></select>\[/code\]I want to be able to default the value that the user already has in the user_pref column 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 users preference. Can anyone please help me with his ?
 
Back
Top