Dropdown in codeigniter using array as values

vietvbb

New Member
I have returned a result_array() in $categories variable and now I want to create a dropdown menu. But if I directly use the variable, all the elements of the array are going to be displayed. However I just want to display the name and keep its id as value. How do i do it?\[code\]$options = $categories;echo form_dropdown('category', $options);\[/code\]I want something like\[code\]<select name="category"><option value="http://stackoverflow.com/questions/14513493/1"> ABC </option>..... <option value="http://stackoverflow.com/questions/14513493/10"> NNNC </option></select>\[/code\]
 
Back
Top