Welcome Guest, Not a member yet? Register   Sign In
why does form on validation error redirect back to last function...
#1

[eluser]Unknown[/eluser]
Hi all,
running into an issue where my form is on say /member/register/ ->
then the user submits, but there is validation errors ->
so i reload the index of that function 'Register' ... but (the URL shows and) it brings me to the last function i was in /member/register/submit/ something like that - what am i missing?
how do i get it to reload /member/register/ instead of /member/register/submit?!?
*shortened the code below but you should get the idea...

Thanks in advance

Code:
class Register extends CI_Controller
{
function index()
{
  $data['main_content'] = 'reg_signup_view';
  $this->load->view('includes/template', $data);
}

function submit()
{
  $this->load->library('form_validation');

  // field name, error message, validation rules
  $this->form_validation->set_rules('fname', 'First Name', 'trim|required');

  if($this->form_validation->run()== FALSE)
  {
     //both of these ways have the same outcome
     //$this->load->view('reg_signup_view');
   //$this->index();
    $data['main_content'] = 'reg_signup_view';
   $this->load->view('includes/template', $data);
  }
  else
  {

     $data['main_content'] = 'signup_successfull';
    $this->load->view('includes/template', $data);

  }
}
}




Theme © iAndrew 2016 - Forum software by © MyBB