form dropdown problem. separate logic and presentation - 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: form dropdown problem. separate logic and presentation (/showthread.php?tid=58242) |
form dropdown problem. separate logic and presentation - El Forum - 05-26-2013 [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"); 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 form dropdown problem. separate logic and presentation - El Forum - 05-28-2013 [eluser]TheFuzzy0ne[/eluser] Welcome to the CodeIgniter forums! I'm not quite sure why you are having problems. You put the logic you have to build your dropdown array into a model method, call the model method from your controller, and then pass the data into the view. It's up to you to decide the name of the model. |