Welcome Guest, Not a member yet? Register   Sign In
Need assist Filtering Comments/Returning Errors to appropriate view.
#12

[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.


Messages In This Thread
Need assist Filtering Comments/Returning Errors to appropriate view. - by El Forum - 05-19-2009, 11:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB