Welcome Guest, Not a member yet? Register   Sign In
Problem with array of checkboxes
#1

[eluser]chicca[/eluser]
Sorry, but i need help again.
I have a view for the maintenance of a db table.
I inserted a new column with checkbox to know which row/rows i have to update or delete.
So I have this in the view

Code:
<tbody>
    &lt;?php foreach($aziende as $azienda): ?&gt;
    <tr>
        <td>
            &lt;?php echo form_checkbox("aziendasel[]", $azienda->idAzienda, FALSE); ?&gt;
        </td>
        &lt;?php foreach($fields as $field_name => $field_display): ?&gt;
        <td>
            &lt;?php echo $azienda->$field_name; ?&gt;
        </td>
        &lt;?php endforeach; ?&gt;
    </tr>
    &lt;?php endforeach; ?&gt;            
</tbody>

and this in the controller's function for updating row (in if block i put these lines to test)

Code:
$aziendasel = $this->input->post('aziendasel');
if (count($aziendasel) == 1)
{
    echo 'count: ' . "'" . count($aziendasel) . "'";
    echo 'contenuto array: ' . "'" . $aziendasel[0] . "'";
}

If i check 0, 1 or more checkboxes, i always get the same result, that is count is 1 and $aziendasel[0] is ''.
What did i wrong?
Thanks in advance




Theme © iAndrew 2016 - Forum software by © MyBB