Auto populating Select lists from DB - 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: Auto populating Select lists from DB (/showthread.php?tid=53856) |
Auto populating Select lists from DB - El Forum - 08-11-2012 [eluser]alvaroeesti[/eluser] Hello, I have some interdependent select lists working well out of codeigniter (using therefore JQUERY, Ajax) but when I am trying to do it in CI, I m not coming on. For a start I need the easiest one to be working, that is, the first one who just gets loaded up by querying the DB without needing jquery, but not even the first select list gets loaded. So here we go with all the modules: VIEW Code: <?php echo form_open('control_form/add_all'); ?> CONTROL Code: public function add_all() MODEL Code: class Model_form extends CI_Model Auto populating Select lists from DB - El Forum - 08-12-2012 [eluser]Aken[/eluser] Your view's foreach() should be: Code: foreach ($city as $row) Because you've named that $data array key "city" in your controller (which I assume should be "state"). Auto populating Select lists from DB - El Forum - 08-12-2012 [eluser]alvaroeesti[/eluser] thank you. that would probably fix it too. what happened was that I was returning a "$result" from the model, while I was having city $data['city'] as index in my array, so replacing city by result, solved it. |