DataMapper CodeIgniter - Dropdown list - 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: DataMapper CodeIgniter - Dropdown list (/showthread.php?tid=58231) |
DataMapper CodeIgniter - Dropdown list - El Forum - 05-25-2013 [eluser]Unknown[/eluser] I want to have a dropdown list with brands, and depending on the choice, it will appear the products of the brand selected. My Tables Code: Brands Code: Products My Models Brands.php Code: <? Products.php Code: <? My Controller ListBrands.php Code: <? I don't know if my controller or models are correctly and also I don't know how to do what I'm asking for, a dropdown that will print the products of the brand selected. DataMapper CodeIgniter - Dropdown list - El Forum - 05-26-2013 [eluser]WanWizard[/eluser] There is nothing in your controller, so lets start with 'the brand selected'. Where do you select that? I assume you have some other controller with a form that contains a brands dropdown? If not, you need that first. First, make sure you have the array extension loaded (manually or in your config file). You can then create a key-value array for an HTML select using: Code: $b = new Brands; Then pass $dropdown to your view to generate the select... |