[eluser]Thorpe Obazee[/eluser]
Code:
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) {
$_POST = xss_clean($_POST);
$this->Movie_model->insertRow('movie_comments', $_POST);
redirect(current_url());
}
}
or
Code:
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) {
$data['comment'] = $this->input->post('comment', TRUE);
$data['author'] = $this->input->post('author', TRUE);
$data['movie_id'] = $this->input->post('movie_id', TRUE);
$this->Movie_model->insertRow('movie_comments', $data);
redirect(current_url());
}
}
The error occurred because there wasn't any $data variable set.