[eluser]Thorpe Obazee[/eluser]
[quote author="dancrew32" date="1242812094"]I threw in some pseudocode in comments() because I'm not particularly sure how to do form_open('movie/comments'); and trigger some kind of conditional statement to run through insert_comment($data).
Code:
function comments()
{
$data['title'] = 'Comments List';
$data['comments'] = $this->Movie_model->fetchRow($this->uri->segment(3), 'movie_id', 'movie_comments');
$this->_insert_comment();
$this->load->view('front/movie_comment_view', $data);
}
private function _insert_comment()
{
$this->form_validation->set_rules('comment', 'Comment', 'required|min_length[1]|max_length[100]|xss_clean|prep_form');
$this->form_validation->set_rules('author', 'Author', 'required|min_length[1]|max_length[40]|xss_clean|prep_form');
if ($this->form_validation->run() === TRUE) {
$this->Movie_model->insertRow('movie_comments', $data);
redirect(current_url());
}
}
Sorry for noobin ya..[/quote]
Code:
// in your view
<?php echo form_open('movie/comments'); ?>
untested but please try this.