0
votes

I'm building a CMS using CodeIgniter.

Currently, after a user edits a page, the form validates, then a redirect sends the user back to the same page.

I would like to automatically add a "Save Successful" message to the redirected page so that the user knows that their action was successful.

Is there a way to pass information through a redirect to accomplish this? If not, is there a better way to go about this?

1

1 Answers

6
votes

Codeigniter Provides Flashdata, which you can use for this purpose. Flashdata stores data in the session for only one request., though you can extend.

    $this->session->set_flashdata('msg', 'Sucess');

    $this->session->flashdata('msg');

    //below code in view
   if(isset($this->session->userdata('msg')))
       echo $this->session->userdata('msg')

http://ellislab.com/codeigniter/user_guide/libraries/sessions.html