1

I have the login form and path is this

http://localhost/xxx/CI/login/

Once user enter the value I do validation

http://localhost/xxx/CI/login/validation

after validation I want to redirect the user to main_page controller , If I load the view of main page it does load the view but path remain same in browser

http://localhost/xxx/CI/login/validation

Where as I want that when the validation is successfull it should show me this path

http://localhost/xxx/CI/main_page

I tried loading controller of main_page but it show me blank page, in main_page controller index function I am loading the view of main page .

1
  • 1
    you should use redirect method as @Rooneyl has stated Commented Apr 2, 2013 at 9:12

1 Answer 1

2

To redirect user after login abd change the URL use the redirect function.
Something like;

public function login() {
    if($this->form_validation->run('login') == TRUE ) {
        // $redirect is what ever page you want to go to
        redirect($redirect);
    } else {
        // show form
        $this->load->view('login_form');
    }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.