CodeIgniter Forums
retrieve data - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: retrieve data (/showthread.php?tid=45644)



retrieve data - El Forum - 09-29-2011

[eluser]Unknown[/eluser]
I have a crud, and when I bring data to populate a ALTER form, I bring all data correct and populate the inputs correct, but I don't know how to populate a dropdown...

I'm doing this way

The inputs that is correct
Code:
echo form_input('title',$data_news[0]->title);

My dropdown(wrong)

Code:
foreach($category as $item)
{
   $drop[$item->id] = $item->name;
}
!set_value('category') ? $selected = null : $selected = set_value('category');
echo form_dropdown('category',$drop,$selected);

it shows the options correcty, but don't bring it with the select option that is in the database