如何使用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'"); ?>