Uahmed
Uahmed

Reputation: 1845

Codeigniter url path?

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 .

Upvotes: 1

Views: 161

Answers (1)

Rooneyl
Rooneyl

Reputation: 7902

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');
    }
}

Upvotes: 2

Related Questions