Welcome Guest, Not a member yet? Register   Sign In
checkbox arrays
#1

[eluser]elmne[/eluser]
I'm trying to retrieve checkbox values from an array so that the checked id numbers in the array can be processed.

I do it like this

In the view, i declare the checkbox like this

Code:
<tr>


        <td>&lt;input type="checkbox" name="checkbox[&lt;?php echo $row-&gt;customer_type_id ?&gt;]" value="&lt;?php echo $row->customer_type_id ?&gt;" /></td>    


</tr>

Then when the form is submitted, i try to process it like this

Code:
$checked = $this->input->post('checkbox[]');


        $checked = $this->input->post('checkbox[]');
        $count = count($checked);
        for($i=1; $i < $count; $i++)

Followed by the sql command that uses
Code:
'".$checked[$i]."'
as a parameter.

But it gives me an error. The sql command fails to work even though no error is shown.

What's wrong with the above code?


Messages In This Thread
checkbox arrays - by El Forum - 05-21-2010, 07:23 AM
checkbox arrays - by El Forum - 06-11-2010, 03:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB