[eluser]Unknown[/eluser]
codeIgniter form_dropdown() function can receive only associative array but I have multi dimension array by using result_array() function. How can I fetch my data on form_dropdown() function?
I can solve this only view page. for example
Code:
$query = $this->db->query("SELECT id, item_name FROM items");
$options = array();
foreach ($query->result_array() as $row){
$options[$row['id']] = $row['item_name'];
}
echo form_dropdown('my_items_dropdown', $options, '1');
But my query is not stay on model. If I want to separate logic and presentation. how can I build model function and how can I show my view page