Dymically Doropdown Optiongroup Using Cdbcriteria


Please how do i dynamically generate array of data in this format.? What i want to achieve is to use this data with my dropdown list as optiongroup data



















//find maincateogry

foreach($maincategory as $val1)


    //find sub category of main category store in to $subcat

    forech($subcat as $val2)



     * $data[$val1]['here you can give custom value which will be set as the value of that option']=$val2;



echo CHtml::dropDownList('name','',$data);