使用codeigniter使用optgroup进行多选下拉列表

时间:2018-06-06 06:33:46

标签: codeigniter dropdown multi-select

如何使用codeigniter使用optgroup将多数选择下拉列表中的错误数组解析为字符串?

模型中的功能:

function getZonaTree2() {
$types = $this->getZonaType();
$tree = array(''=>'-- Region --');
$this->getListTreeParent($listZona, 0, 0);
foreach($listZona as $r) {
    if($r->LEVEL==1) {
        $tree[$r->ZONA_NAME] = array();
        $zona_parent_1 = $r->ZONA_NAME;
    }
    if($r->LEVEL==2) {
        $tree[$zona_parent_1][$r->ZONA_NAME] = array();
        $zona_parent_2 = $r->ZONA_NAME;
    }
    if($r->LEVEL==3) {
        $tree[$zona_parent_1][$zona_parent_2][$r->ZONA_ID] = $r->ZONA_NAME." (".$r->ZONA_CAPITAL.") - ".$types[$r->TYPE];
    }
}
return $tree;

}

观点:

<?php echo form_multiselect('zona_id', $this->Zona_model->getZonaTree2(), array(), "size=8 id='zona_id'"); ?>

I want to make multilevel dropdown, to level 1 and 2 already managed to perform, but to level 3 get the error array to string.Here's how it looks

0 个答案:

没有答案