![]() |
dropdown data - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: dropdown data (/showthread.php?tid=4903) |
dropdown data - El Forum - 12-22-2007 [eluser]r@mtbb_[/eluser] Hi, Can anyone please give an exemple of how to populate a form_dropdown() with the contents of a mysql table? I cannot manage to do this.. Thanks! dropdown data - El Forum - 12-22-2007 [eluser]tonanbarbarian[/eluser] yeah i admit that i would prefer if the structure of the options in form_dropdown worked a bit differently but to get it to work try something like this Code: $options = array(); The query will return results like Code: array( and then the processing of the results will return something like Code: array( However I prefer the first format for the options because it is much easier to retrieve from a query and does not require any processing before being passed to the function. p.s. while Code: $query->free_result(); dropdown data - El Forum - 12-22-2007 [eluser]r@mtbb_[/eluser] Thanks a lot! I'll try it right away dropdown data - El Forum - 02-16-2008 [eluser]Bharani[/eluser] hi dear i have used your code..but in form combo not dislayed can you send the view form code for this Code: <div class="formArea"> dropdown data - El Forum - 02-16-2008 [eluser]mooger[/eluser] [quote author="Bharani" date="1203167140"]hi dear i have used your code..but in form combo not dislayed can you send the view form code for this Code: ... [/quote] Change it to Code: <? echo form_dropdown('field_name', $options);?> dropdown data - El Forum - 02-16-2008 [eluser]Bharani[/eluser] got result thanks |