-2
我是codeIgniter中的新成員,而且我的數據庫和下拉菜單有點麻煩。dropdown codeigniter
我的模型
function list_kategori(){
$query = $this->db->get($this->table1);
$option = array();
foreach($query->result_array() as $row) {
$options[$row['id_cat']] =$row['categori'];
}
return $options;
}
我控制器
public function listkategori(){
$data['kategori']=$this->Mtugasuas->list_kategori();
$data ['test'] = form_dropdown('kategori', $data);
}
我查看
<?php
echo form_open('tugasuas/listkategori');
echo $test;
echo form_close();
?>
錯誤
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: test
Filename: blackcoffe/add.php
Line Number: 12
我做錯了什麼? THX求助