CodeIgniter “flashdata” doesn't work

前端 未结 12 2009
灰色年华
灰色年华 2020-12-03 18:10

I use CodeIgniter 2.1.0, i want after insert data in database get a message like \"Your information was successfully updated.\". For this work i have in CI_Controller follow

12条回答
  •  眼角桃花
    2020-12-03 18:39

    I use this for flash data and it's easy to use. first, need to you have creat session and then in your controllers' method use this just before where you want to redirect your page.

    On Controller after creating a session and don't forget to load session and url library.

    $this->session->set_flashdata('success', 'Oops. This email id already exist.' );
    redirect("You Mehod or page");
    

    In this case, you no need to go to your particular view page to add extra php code.

    And on footer.php in view past this script code

    
    
    
    
    
    

    Good luck and hope it will help for your problem.

提交回复
热议问题