how to create dynamic drop down |
[eluser]shades[/eluser]
im new to ci & enjoying it very much. but i cant populate my drop down dynamically. i have controller that calls model where there get all() method. my dbtable has only 3 column they are id title & desc, i want to populate form_dropdown in my view and it should display title & while submit it it should take id of selected title to my database. plz any one help me on this.
[eluser]steelaz[/eluser]
In your controller load form helper, create array where key is "id" and value - "title" and pass this array to your view. Code: $this->load->helper('form'); Then in your view you can use form helper's form_dropdown() function to render HTML for dropdown: Code: <?= form_dropdown('dropdown_name', $dropdown); ?> http://ellislab.com/codeigniter/user-gui...elper.html |
Welcome Guest, Not a member yet? Register Sign In |