I have some group of inputs each with same name, as shown in the picture
I want to save each category with each number of rooms and standard rate. All category inputs have the same name (<input name="category[]">
) same for No. of rooms and standard rate.
So far I've tried:
foreach($data['category'] as $cat){
$this->Model->save($cat)
//Will save only categories without No. of rooms and standard rate.
}
Is there a way I can foreach
through the 3 groups of inputs and save data in different rows accordingly? My table columns are named after inputs name.
Are you able to send this type of format to your controller, then you can use saveMany() function in Caek php "
http://book.cakephp.org/2.0/en/models/saving-your-data.html
or in
format.
You can do like this $this->Model->saveMany($data);