[eluser]razputin[/eluser]
Let's say I have a url like example.com/articles/view/1234
On this page users can submit a comment, how can I return them to the same page/url on either success or failure?
Currently I have a function in the controller add_comment, and when they submit the comment it takes them to example.com/articles/add-comment and I want it to be the same as the url they submitted the comment on.
For now I'm cheating to redirect them to the same page with:
Code:
function add_comment()
{
$this->load->library('form_validation');
// field name, error message, validation rules
$this->form_validation->set_rules('comment', 'Comment', 'trim|required|min_length[2]|xss_clean');
if($this->form_validation->run() == FALSE)
{
$this->view(1234);
}
So how do I redirect them to the previous page and retain the original url?