How to automatically choose the correct value in a select box when loading data from database |
[eluser]tochie[/eluser]
Hi Brethren, I want to automatically choose the correct value in a select box when loading data from database. E.g. When displaying a form for editing (data is loaded from db), the select box for 'year' should have the year previously entered into the database. I couldn't find it in the form helper. Please anyone know how i can do this with CI? Thanks
[eluser]n0xie[/eluser]
You can find it here: http://ellislab.com/codeigniter/user-gui...rreference Code: <select name="myselect"> You have to write an if statement to match the value against your database value. If it matches, set boolen to true else set it to false
[eluser]tochie[/eluser]
Thanks ppl. Your suggestions were helpful. One CI! One Luv! |
Welcome Guest, Not a member yet? Register Sign In |