我尝试通过基于字段划分的选择选项显示数据并成功,但如何显示所有数据?
控制器
public function dokumen()
{
$divisi = $this->input->post('divisi');
$data=array('title' =>'KOPKAR - Pelanggan',
'divisi' => $this->induk_internal->get_divisi(),
'get_dokumen' => $this->induk_internal->get_dokumen($divisi),
'isi' =>'admin/DCR/daftarindukinternal'
);
$this->load->view('layout/wrapper',$data);
}
模型
function get_dokumen($divisi) {
$this->db->select('*');
$this->db->from('daftar_detail_internal');
$this->db->where('divisi',$divisi);
$query = $this->db->get();
if ($query->num_rows() > 0) {
return $query->result();
} else {
return false;
}
}
浏览
<div class="col-md-3">
<select class="selectpicker" style="display: none;" name="divisi" autofocus>
<option value="if click show all data">ALL</option>
<?php foreach($divisi as $row) { ?>
<option value="<?php echo $row->divisi;?>"><?php echo $row->divisi;?>
</option>
<?php } ?>
</select>