Thursday, October 23, 2014

Save many of the same model

Basically user selects a section and adds all users to it. I used the form below

<?php echo $this->Form->input("SectionsUser.section_id"); ?>  <?php echo $this->Form->input("SectionsUser.user_id", array('multiple'=>'checkbox')); ?>      

Which generated 
Array  (      [section_id] => 1      [user_id] => Array          (              [0] => 3              [1] => 4          )    )

 How do i save it. I wish to save above data or suggest me a way to modify my form to generate data in the correct format. 

I know i can ;loop through this data n convert to saveAll format but is there a way to achieve same in a cakeohp way 


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: