A function in the controller User loads the signup form, eg:
public function signup()
{
$this->load->view('form_view');
}
So the signup form url will be like root/user/signup (ignore index.php)
The form_view has a form, which is submitted to another method in the same controller, lets say process(), eg.
<? echo form_open('user/process') ?>
Once the form is submitted, it goes to the user/process, which contains the validation code. If there is any validation error, It would load the form_view again and pass the error data to display on the form.
if ( $this -> form_validation -> run() === FALSE )
{
//$this -> load -> vars( $data );
$this -> load -> view( 'form_view' );
}
Everything works fine. But now since the same form_view is loaded from the user/process function, the url of the form will change from:
root/user/signup
to
root/user/process
Because the form was submitted to the url user/process and the form_view is being called from the process(). Is it possible to somehow redirect or maintain the original form url(root/user/signup) when the form_view is loaded from the process function in case of errors?
Thanks.