php - create dyanamic dropdown using Codeigniter form helper and get value from database -
my array this
array ( [0] => array ( [id] => 1 [name] => admin )
[1] => array ( [id] => 2 [name] => manager ) [2] => array ( [id] => 3 [name] => user ) [3] => array ( [id] => 6 [name] => visitor ) [4] => array ( [id] => 35 [name] => gggggggggg )
)
and trying create
foreach($data $row) { $dropdownlist[$row['id']] = $row['name']; } $insattr = "class='form-control'"; echo form_dropdown("iddropdown", $dropdownlist, "", $insattr);
Comments
Post a Comment