![]() |
Problem with validation redirect - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Problem with validation redirect (/showthread.php?tid=43277) |
Problem with validation redirect - El Forum - 07-06-2011 [eluser]jacobson[/eluser] Hello, I have a problem... I have a register form and I have in my controller "register" a method process which process data from the form, checks validation etc... I have a line : Code: if($this->form_validation->run() == FALSE){ And everything workes fine except one thing. When the user puts wrong data it "redirects" by $this->index. But in my URL i have localhost/index.php/register/process address. When I try redirect('register') it works but no errors appears when user puts wrong data, so $this->index() is needed. What can I do in order to have proper url after form submitting. Thx for respnding. Problem with validation redirect - El Forum - 07-07-2011 [eluser]Irfan Cikoglu[/eluser] Use like this: Code: $this->load->view('register', $data); ![]() Problem with validation redirect - El Forum - 07-07-2011 [eluser]mbrzuzy[/eluser] [quote author="Irfan Cikoglu" date="1310068346"]Use like this: Code: $this->load->view('register', $data); ![]() He might have code that he needs executed in the index() function before loading the registration page, in that case what he could do is something like this: Code: redirect('register'); or Code: redirect(base_url() . 'register'); depending on how you have your site setup. Problem with validation redirect - El Forum - 07-07-2011 [eluser]Irfan Cikoglu[/eluser] [quote author="mbrzuzy" date="1310069495"][quote author="Irfan Cikoglu" date="1310068346"]Use like this: Code: $this->load->view('register', $data); ![]() He might have code that he needs executed in the index() function before loading the registration page, in that case what he could do is something like this: Code: redirect('register'); or Code: redirect(base_url() . 'register'); depending on how you have your site setup.[/quote] Sorry, it looks like i misunderstood the question. Problem with validation redirect - El Forum - 07-07-2011 [eluser]mbrzuzy[/eluser] [quote author="Irfan Cikoglu" date="1310070125"][quote author="mbrzuzy" date="1310069495"][quote author="Irfan Cikoglu" date="1310068346"]Use like this: Code: $this->load->view('register', $data); ![]() He might have code that he needs executed in the index() function before loading the registration page, in that case what he could do is something like this: Code: redirect('register'); or Code: redirect(base_url() . 'register'); depending on how you have your site setup.[/quote] Sorry, it looks like i misunderstood the question.[/quote] I just re-read his question, looks like I was the one to misunderstand. jacobson: Is the problem that errors aren't displaying, or the form isn't populating with the data they entered before submitting? Problem with validation redirect - El Forum - 07-07-2011 [eluser]Irfan Cikoglu[/eluser] [quote author="mbrzuzy" date="1310070411"][quote author="Irfan Cikoglu" date="1310070125"][quote author="mbrzuzy" date="1310069495"][quote author="Irfan Cikoglu" date="1310068346"]Use like this: Code: $this->load->view('register', $data); ![]() He might have code that he needs executed in the index() function before loading the registration page, in that case what he could do is something like this: Code: redirect('register'); or Code: redirect(base_url() . 'register'); depending on how you have your site setup.[/quote] Sorry, it looks like i misunderstood the question.[/quote] I just re-read his question, looks like I was the one to misunderstand. jacobson: Is the problem that errors aren't displaying, or the form isn't populating with the data they entered before submitting?[/quote] The question turned into a puzzle ![]() Problem with validation redirect - El Forum - 07-07-2011 [eluser]jacobson[/eluser] I have a form with some validation. All data from the form are being processed to the process method in register function. There I set the validation rules and check whether errors appeared or not if so code $this->index() "redirect" the site with errors on my register site appeared. If I use the redirect('register') it does redirect to the proper site but errors do not appear. But it's not a problem with $this->index() or redirect('register') it's a problem with the URL which still shows the process in the URL after submitting the form. In my index function in register controller I only load the register view. Problem with validation redirect - El Forum - 07-07-2011 [eluser]CodeIgniteMe[/eluser] This question has been answered already in another thread. Clean URLs You cannot get any post data when you redirect() the page because you are doing a header redirect. |