CodeIgniter Forums
Form dropdown from double array. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Form dropdown from double array. (/thread-55178.html)



Form dropdown from double array. - El Forum - 10-13-2012

[eluser]Darker[/eluser]
Code:
Array ( [0] => Array ( [country_id] => 1 [country] => Afghanistan ) [1] => Array ( [country_id] => 2 [country] => Albania ) [2] => Array ( [country_id] => 3 [country] => Algeria ) [3] => Array ( [country_id] => 4 [country] => American Samoa )

How can i do a form_dropdown with it ?
I mean
Code:
<option value="2">Albania</option>

Thanks!


Form dropdown from double array. - El Forum - 10-14-2012

[eluser]xeroblast[/eluser]
Code:
$your_double_array = array();
foreach ( $your_double_array as $c ) {
$data['country'][$c->country_id] = $c->country;
}