Welcome Guest, Not a member yet? Register   Sign In
Ignore submit button when inserting with Active Record
#2

[eluser]Eric Barnes[/eluser]
I imagine you are not setting an array and instead using the post array. I always do it like this:
Code:
$author = $this->input->post('comment_author', TRUE);
$email = $this->input->post('comment_author_email', TRUE);
$comment = $this->input->post('comment_content', TRUE);
$data = array(
                'comment_article_ID' => $this->input->post('comment_article_ID', TRUE),
                'comment_author' => $author,
                'comment_author_email' => $email,
                'comment_content' => $comment,
                'comment_author_IP' => $this->input->ip_address()
            );
$this->db->insert('comments', $data);

This also gives you the ability to check the data submitted and do any processing on it. Which you should also be using the form validation class.


Messages In This Thread
Ignore submit button when inserting with Active Record - by El Forum - 08-01-2009, 05:36 PM
Ignore submit button when inserting with Active Record - by El Forum - 08-01-2009, 07:40 PM
Ignore submit button when inserting with Active Record - by El Forum - 08-01-2009, 09:09 PM



Theme © iAndrew 2016 - Forum software by © MyBB