Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to redirect user with session message in Codeigniter?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 529
    Comment on it

    Hello Reader's If you want to make user redirect and show him the error message on next page then by using codeigniter you can do by following functions:-

    Let's say if user input wrong username/password then you'll redirect user by following code of redirect:-

    redirect('/login/form/', 'refresh');
    

    now in addition you can make the user show the error message on redirected page as follows:-

    $this->session->set_flashdata('message', 'This is a message. Showing the error for invalid login');
    

    Now you just have to open the redirected page and put this line on top:-

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

    And the this message will print for once only.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: