I am facing a very strange issue, the Codeigniter's flash data is not available 1 out of 10 time. Most of the time it works but randomly it doesn't. So, someone could help me know what could be the reason for this.
Controller Code
public function set_pagelist(){
$site_id = $this->input->get('site_id');
$use_list = $this->input->get('use_list');
if($use_list=="1"){
$use_list = (int) $use_list;
}
$data = array("site_id" => $site_id,"page_list_option" => $use_list);
$url_send = $this->api_url."set_pagelist_option";
$str_data = json_encode($data);
$request = sendPostData($url_send, $str_data);
$response = json_decode($request, true);
$errors = $response['errors'];
$response_message = $response['response_message'];
if (isset($response_message) && isset($errors)) {
if (trim($response_message) === "Value Set" && trim($errors) === "None") {
$this->session->set_flashdata('upload_message', '<p><div class="alert-box success"><span>success: </span>Value has been set successfully</div></p>');
redirect("manage-domain");
} elseif($response_message === "Error" && $errors === "Invalid Pagelist Option") {
$this->session->set_flashdata('upload_message', '<p><div class="alert-box error"><span>Error: </span>Invalid Pagelist Option</div></p>');
redirect("manage-domain");
}
} else {
$this->session->set_flashdata('upload_message', '<p><div class="alert-box error"><span>Error: </span>OOPS some error occurred</div></p>');
redirect("manage-domain");
}
}
In view:
echo $this->session->flashdata('upload_message');