I have one code block for assigning some values to flashdata
in report
controller and another block for accessing flashdata
in export_data
controller.
Report
Controller:
if ($this->input->get_post('date_frm')) {
$conditions[] = 'appointment_date >= "'.trim($this->input->get_post('date_frm', TRUE)).'"';
}
if ($this->input->get_post('date_to')) {
$conditions[] = 'appointment_date <= "'.trim($this->input->get_post('date_to', TRUE)).'"';
}
$conditions = $this->search_model->searchterm_handler($conditions);
$this->session->set_flashdata('ext_data', $conditions);
And in Export_data
Controller:
$myVar = $this->session->flashdata('ext_data');
$this->session->keep_flashdata('ext_data');
It does not always work, but when I use userdata
rather than flashdata
it is working fine. Why?