class Mymodel extends CI_Model {
public function getJp($jp=""){
$sql = "SELECT * FROM daftarpaket WHERE jenisproduk = ?";
$data = $this->db->query($sql, $jp);
return $data->result_array();
}
}
class Controller extends CI_Controller {
public function daftarPaket($jp=""){
$data = $this->mymodel->getJp("$jp");
return $data->result_array();
}
}
在单击"提交"按钮之前,如何从"选择"选项的值中获取我的 Daftarpaket 和 Daftarpaket 参数的result_array?
泰
控制器文件中
的class Controller extends CI_Controller {
public function daftarPaket($jp=""){
$data['jp'] = $this->mymodel->getJp("$jp");
}
在视图中选择选项
<select><?php if(count($jp)>0){ foreach($jp as $jpdata){ ?> <option value="<?php echo $jpdata['name'] ?>" ><?php echo $jpdata['name'] ?></option><?php }}?></select>