Accessing array element "id" in codeigniter does not work. Cant find a possible cause to fail. If anyone can show the proper way to do that will be helpful,
My View
<form name ="userinput" onsubmit="return test()" action="<?php echo base_url(); ?>index.php/patient/saveNewExaminationChart/<?php echo $pd['id']; ?>" method="post">
<?php echo $pd['id']; ?>
For this part i want to get the id number passed by controller to view.
My Controller
public function editPeriodicalDetails(){
$pid = $this->uri->segment(3);
$this->load->model('patient_model');
$patient['pd'] = $this->patient_model->getPeriodicalChart($pid);
$this->load->helper('url');
$this->load->view('Header');
$this->load->view('Patient/editPeriodicalExam',$patient);
$this->load->view('Footer');
}
My Model
public function getPeriodicalChart($id){
$this->load->database();
$this->db->select('*');
$this->db->from('periodical_examination a');
$this->db->join('patient p','p.id = a.pid');
$this->db->where('a.pid',$id);
$query = $this->db->get();
return $query->result();
}