Form_validation == false, reload class |
[eluser]mojitoo[/eluser]
Hey! I've written a forum where the users can answer to a thread. But I want check if the users have written something in the answer box. My problem is how I shall write to redirect the users back to the correct address since it contains a thread id like this: www.example.com/show_thread/3424de3 The code works just fine if I write $this->show(); but the problem is then that the user leaves the thread. So I tried to do a redirect instead but that didn't work. So how shall I write to reload the method show_thread with an id? Code: function add_answer() {
[eluser]Stefan Hueg[/eluser]
You have two options. Either: Upon requesting the thread page, put a variable like "last_url" in the users session where you store the current URL, like: Code: $this->session->set_userdata('last_url', $this->uri->uri_string()); Code: redirect($this->session->userdata('last_url')); Or: Code: redirect($_SERVER['HTTP_REFERER']); //unsafe I hope that helps. |
Welcome Guest, Not a member yet? Register Sign In |