[eluser]k2zs[/eluser]
[quote author="bretticus" date="1289296985"][quote author="k2zs" date="1289290949"]
Any thoughts?[/quote]
Yes, however convenient inserting the $_POST variable directly into $this->db->insert() is, it's probably a bad idea. For one, any remote post attempt has the power to build queries that will break your code (with escaping on automatically, you're probably safe from injection but you never know.) The main reason, however, is you forfeit the models ability to ensure that data is formatted in the manner it was intended to be.
I recommend having model method parameters that have a one-to-one mapping with a table field.
From there it's easy to write some logic to handle check boxes.
Controller:
Code:
$this->your_model->insert(/.../, $this->input->post('check_box'));
your_model:
Code:
function insert(/.../, $check_box) {
if ( $check_box === FALSE )
$data['check_box'] = 0;
else
$data['check_box'] = 1;
/.../
$this->db->insert('table', $data);
}
[/quote]
whats the "/.../" used for?