Welcome Guest, Not a member yet? Register   Sign In
Checkboxes not inserting into database
#1

[eluser]mdcode[/eluser]
I have some check boxes on a form that will not pass the 'TRUE' value into the database. I always use 0 for not selected and 1 for selected, but when the form is submitted, the result is always 0.

VIEW
Code:
<?php echo form_checkbox('ss_supplied', '0', FALSE) ?> Substrate supplied

MODEL (part of an array)
Code:
'ss_supplied'=>$this->input->post('ss_supplied', TRUE),

I am currently not using any validation though will be down the line, I just need to make sure it's going to go into the db correctly.
#2

[eluser]mdcode[/eluser]
Never mind guys, I have fixed this issue... again, I'm being dense on this, as the value has to be 1 as if the box is not ticked it won't pass any value, so would automatically pass 0 to the db - if it is, it passes 1, like this:

Code:
<?php echo form_checkbox('ss_supplied', '1', FALSE) ?> Substrate supplied




Theme © iAndrew 2016 - Forum software by © MyBB