[eluser]skunkbad[/eluser]
Code:
$segs = $this->uri->segment_array();
// assuming that article ID is always the last URI segment
$articleid = end( $segs );
redirect('section/articles/subsection/' . $articleid);
Normally I post all forms to the same method, and by doing that, the above code would work. You'd just have to run form validation and determine if there is a valid post vs a page load of the article.
I think for your code, you might try this:
Code:
function comments_insert()
{
$this->db->insert('comments', $_POST);
redirect('section/articles/subsection/' . $this->input->post('articleid'));
}
Although unless you are validating the $_POST array and rewriting $_POST, you're using some potentially unsafe code;