I use the following codes to redirect my user to the previous page after completing a specific task.
if (isset($_SERVER['HTTP_REFERER'])) { $this->session->set_userdata('previous_page', $_SERVER['HTTP_REFERER']); } else { $this->session->set_userdata('previous_page', base_url()); }
The code above I use in the controller and the following code in another controller.
.... some other stuffs... I am updating database values here.... $this->db->where('t_expenseid', $t_expenseid); query=$this->db->update('teacherexpense', $data); redirect($this->session->userdata('previous_page'));
The above code works fine, but the problem I ran into is sending a message with a successful redirect message so that when the previous page loads, a success message will appear (I already have jquery). And for this, I added the following code above the redirect, but I don't know how to send $ data or a message along with the redirect. And if I can send it, how to get the value in the controller of the previous page.
$data['msg']='Information Has been Successfully Inserted';
Could you tell me how to send it and then receive it?
Thanks:)
source share