i want to pass variable from one function in codeigniter to another they are sharing the same class. they are part of form.
class C_Reservation extends CI_Controller {
private $params = array();
private $post;
public function index()
{
$this->params['post'] = array(
'name' => '',
'last_name'=>''
);
$this->load->view('common/default_header',$this->params);
$this->load->view('reservation/index',$this->params);
$this->load->view('common/default_footer');
}
public function add(){
$error =false;
$error_list =array();
session_start();
$this->load->library('InputProcess');
$this->load->library('session');
if($this->input->server('REQUEST_METHOD')!="POST"){
show_404("Formularz dodawania obiektu - brak danych POST");
}
//filtrowanie danych
$this->post=array(
'name'=>$this->input->post('name'),
'last_name'=>$this->input->post('last_name')
);
echo $this->post['name']; // this place is showing name from form
$this->load->view('common/default_header',$this->params);
$this->load->view('reservation/complete',$this->params);
$this->load->view('common/default_footer');
}
public function export_pdf(){
session_start();
$html=$this->load->view('pdf/index', $this->post,false);
$this->load->library('m_pdf');
$pdf = $this->m_pdf->load();
$pdf->WriteHTML($html);
$pdf->Output();
}
}
add function is unfinished it just need to "save" variable that i can acces it from function export_pdf anyone ?