How to set segment to view in codeigniter after form validation fails? |
[eluser]Unknown[/eluser]
I am validating a form on many views that are generated by the third URL segment. The URL: http://example.com/listings/item/12 (The 12 will change based on item) Both my functions are below, my question is, when the validation fails how to I refresh the page with the 3rd segment and show the validation errors? P.S: I have already tried redirect() but the validation errors don't remain. Thank You. This is the "item" function Code: public function item() This is my validation. Code: public function get_email()
[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgniter forums! As soon as you redirect, the $_POST data is not submitted to the server, and this you lose your error messages. You shouldn't redirect until after validation has passed. Your execution flow should be something like this: Code: function item($id = 0) I know that the above doesn't fit in to how you're doing things, but hopefully it'll help get you started. |
Welcome Guest, Not a member yet? Register Sign In |