Welcome Guest, Not a member yet? Register   Sign In
retrieve data

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
echo form_input('title',$data_news[0]->title);

My dropdown(wrong)

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

Theme © iAndrew 2016 - Forum software by © MyBB