CodeIgniter Forums
Drop-down return MYSQL results - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Drop-down return MYSQL results (/thread-59473.html)



Drop-down return MYSQL results - El Forum - 10-09-2013

[eluser]Unknown[/eluser]
Good morning,

I am new to Code Ignitor and rather new to PHP as well so I appreciate your assistance to begin with.

I have a drown-down menu (hard coded with options) that stores the results in a table. My question is if I go back to edit those results they of course default back to the hard coded order. How do I make the drop-down display the option that was originally selected and stored in the DB?


<select name="client_type">
<option name="client_type" value="Retail">Retail</option>
<option name="client_type" value="Ad Speciality">Ad Speciality</option>
<option name="client_type" value="Combination">Combination</option>
</select>


Drop-down return MYSQL results - El Forum - 10-09-2013

[eluser]CroNiX[/eluser]
http://ellislab.com/codeigniter/user-guide/helpers/form_helper.html
Look at the form helper, specifically the form_dropdown() function.