I have two tables: 1. STUDENT- fields are- (studentid,studentname,batch) 2. BATCH- fields are- (batchid,batchname)
I want to populate a dropdown list from the field "batchname" ( from the table "BATCH") and have the batchname selected based on the field-"batch" (from the table "Student")
My controller -
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);
}
My model -
function batch_get()
{
$query = $this->db->get('batch');
return $query->result();
}
Now, I cannot figure out how to populate the dropdown in the "View". Would you please kindly help me with this?
Thanks in Advance.