Cake can do all that for you in just one input unless you have some
specific requirement I did not pick up on from your post.

echo $form->input('ProfilePermissionsMaster.permission', array
('type'=>'select', 'value'=>array(1,2,3), 'options'=>array(1,2,3),
'multiple'=>'checkbox'));

Notice that value is an array of values that are selected, options is
the array of available values (one checkbox per item). This will give
you an array like the one you want.



On Mar 28, 8:55 am, keyurvaghani <keyurvagh...@gmail.com> wrote:
> Hello Friends,
>
> I am keyur vaghani and working on cake php 1.2.
>
> Please help me out from following issue on cake php 1.2 related to
> post values of selected multiple check boxes.
>
> I want to list multiple check boxes with same name on different rows
> and post its values as array with selected (checked) check boxes, but
> it couldn't and only get post value as last selected control check box
> element value.
>
> Because It will generate auto hidden element with each different row
> check box control and here the original check box control name is
> generated with array and it is correct like [Model][fieldname][] but
> it couldn't generate this array name of hidden control that's why i am
> facing major trouble while posting.
>
> for example,
> <?php
>
> $options=array(1=>" Test Check Box Option1");
> e($form->select('ProfilePermissionsMaster.permission',
> $options,NULL,array('multiple'=> 'checkbox' , 'separator'=>' <br>
> ','value'=>'1')));
>
> $options2=array(1=>" Test Check Box Option2");
> e($form->select('ProfilePermissionsMaster.permission',
> $options2,NULL,array('multiple'= >'checkbox' , 'separator'=>' <br>
> ','value'=>'2')));
>
> $options3=array(1=>" Test Check Box Option3");
> e($form->select('ProfilePermissionsMaster.permission',
> $options,NULL,array('multiple'=> 'checkbox' , 'separator'=>' <br>
> ','value'=>'3')));
>
> ?>
>
> It want post values like as below, but couln't get it ??
>
> Array( [ProfilePermissionsMaster] =>Array(
>
> [permission] => Array
> (
> [0] => 1
> [1] => 2
> [2] => 3
> )
>
> )
>
> )
>
> as well as when ever i set value attribute, it will display checked
> check box why?
>
> Thanks and Regards,
> Keyur.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to