[eluser]hawkeye000[/eluser]
Hello every body
i have this array return from a model function
Code:
/////model function
function getSubCats($catid){
$query= "select * from levels where Parent_Level='$catid'";
$rst = $this->db->query($query);
if($rst->num_rows==0){
return null;
}else{
$rstt=$rst->result();
foreach($rstt as $row1) {
$categories[$row1->Level_ID] =$row1->Level_Title;
$children = $this->getSubCats($row1->Level_ID);
if($children!=null){
$categories[$row1->Level_Title]=$children;
}
}
return $categories;
}
output :
Array
(
[2] = GR4
[GR4] = Array
(
[5] = A
[A] = Array
(
[7] = e
)
[6] = B
)
[3] = GR5
[4] = GR6
)
How can i convert it to dropdown menu? i tried to use form_dropdown put it gave me this
Code:
<select name="Grades">
<option value="2">GR4</option>
<optgroup label="GR4">
<option value="5">A</option>
<option value="A">Array</option>
<option value="6">B</option>
</optgroup>
<option value="3">GR5</option>
<option value="4">GR6</option>
</select>