I am using cakephp and trying to pass an array from the view to the controller, i do generate a checkbox of names, the user should select some names and submit his request.
echo $this->Form->create('Task');
echo ($this->Form->input('sentTo', array('type' => 'select', 'multiple' => 'checkbox', 'options' => $options)));
echo $this->Form->end('submit');
the problem is the sentTo checkbox will return the indices checked in $this->request->data i don’t want to do that, i want to return the ids of the users which i can get in the view. so i want to replace these indices with other numbers, i tried to manually overwrite $this->request->data but the changes become only visible in the view and not the controller.
If you please know how to alter the request data before sending it to the controller, or pass arrays from the view to the controller try to help me (i don’t want to use the session or the cache)
Regards
If I understood your problem correctly, and from the comments above, this is your problem:
If you are using that for the checkboxes then change that to:
Although I don’t get what
'u1'is.In short: set the keys of the
optionsarray to the id of the records.