I am trying to insert multiple checkbox with different value into corresponding database column.
For example:
View:
I have 4 checkbox:
<input type="checkbox" name="approverAccess[]" value="LA" >
<input type="checkbox" name="approverAccess[]" value="OA" >
<input type="checkbox" name="approverAccess[]" value="PC" >
<input type="checkbox" name="approverAccess[]" value="TS" >
And the table is something like this:
So the scenario is, If the first checkbox is checked, C1 column will have a value of '1' and the rest is '0', if second checkbox is checked C2 column will have a value of '1' and the rest is '0' and so on. Whatever checkbox is check it should be show or add in the corresponding table column.
Controller:
foreach($approverAccess as $selected) {
// ***What I'm going to do here****
}
$data = array(
'ID' => '',
'USERID' => $adminID,
'C1' => $selected,
'C2' => $selected,
'C3' => $selected,
'C4' => $selected
);
$this->dbquery->modInsertval('tblapprover',$data);
How can I proceed with this?

approverAccessC1,approverAccessC2,approverAccessC3, andapproverAccessC4? In this case, I'm not sure using an array really provides any benefit.