【发布时间】:2011-09-06 08:47:13
【问题描述】:
我有两张表: 1. STUDENT- 字段是- (studentid,studentname,batch) 2. BATCH- 字段是- (batchid,batchname)
我想从字段“batchname”(来自表“BATCH”)填充一个下拉列表,并根据字段-“batch”(来自表“Student”)选择批次名称
我的控制器 -
function update($id){
$this->load->model('mod_studentprofile');
$data['query']= $this->mod_studentprofile->student_get($id); //to retrieve information from the table "STUDENT"
$data['query']= $this->mod_studentprofile->batch_get();
$data['main_content']='update_studentprofile';
$this->load->view('includes/template',$data);
}
我的模型 -
function batch_get()
{
$query = $this->db->get('batch');
return $query->result();
}
现在,我无法弄清楚如何在“视图”中填充下拉列表。你能帮我解决这个问题吗?
提前致谢。
【问题讨论】:
标签: php codeigniter