I am using CodeIgniter and I have a route set up as follows:
$route["(:num)"] ="login/login_by_id/$1";
This basically means that when the URL looks like this:
http://mydomain.com/12345
This will effectively pass the value 12345 into the login_by_id method of the login controller. Everything works fine when I enter the URL directly. Where I am having a problem is when I try to load a view. These are the lines which call the view:
$data['content'] = 'login_view';
$data['title'] = 'Login';
$data['error_msg'] = 'Invalid password. Please try again.';
$this->load->view('login_template', $data);
My problem is that instead of returning the user back to here:
http://mydomain.com/12345
The browser directs the user to this URL:
http://mydomain.com/login/login_by_id
How can I change the code so that I return my user back to the same URL they were at previously? I don’t want to be showing the controller/method in the URL address.
Thanks.
In the function ( the one which you are calling after hitting the submit button) in controller.