CodeIgniter Forums
Help with an form array - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Help with an form array (/showthread.php?tid=33985)



Help with an form array - El Forum - 09-15-2010

[eluser]Unknown[/eluser]
I have a problem with retrieving array data from a form.

This is how the part of the form is generated:
Code:
foreach ( $roles as $role )
{
    echo '<p>'.$role->name.' '.form_checkbox($data = array('name' => 'roles[]', 'id' => 'roles'.$role->id, 'value' => $role->id, 'checked' => false)).'</p>';
}

I try to retrieve the array in the code as:
Code:
$rolesId=$this->input->post('roles');

But it is always null. In xdebug $_POST i can see that roles is an array and its values.

Any suggestions on how to get the data out?


Help with an form array - El Forum - 09-15-2010

[eluser]Unknown[/eluser]
Hmm... must be something really basic I am doing wrong... going back to debug mode