I want to set the following code for SaveAll() in cakephp: -


array( 'student' => array(     'student_name' => array(         (int) 0 => '14',         (int) 1 => '17',         (int) 2 => '18'     ),     'fee_name' => array(         (int) 0 => '1',         (int) 1 => '1',         (int) 2 => '1'     ),     'standard_name' => array(         (int) 0 => '1',         (int) 1 => '1',         (int) 2 => '1'     ),     'section_name' => array(         (int) 0 => '7',         (int) 1 => '7',         (int) 2 => '7'     ),     'day_name' => array(         (int) 0 => '2015-04-23',         (int) 1 => '2015-04-23',         (int) 2 => '2015-04-23'     ),     'feeplan_name' => array(         (int) 0 => '4',         (int) 1 => '4',         (int) 2 => '4'     )   ) ) 

i want change following array code format in cakephp saveall() applicable. english little weak sory tks in advance.

take on savemany

edit:

your html should this

<input type="text" name="data[student][0][student_name]"> <input type="text" name="data[student][1][student_name]"> <input type="text" name="data[student][2][student_name]">  <input type="text" name="data[student][0][fee_name]"> <input type="text" name="data[student][1][fee_name]"> <input type="text" name="data[student][2][fee_name]"> 

then array be

array(     'student' => array(         (int) 0 => array(             'student_name' => '',             'fee_name' => ''         ),         (int) 1 => array(             'student_name' => '',             'fee_name' => ''         ),         (int) 2 => array(             'student_name' => '',             'fee_name' => ''         )     ) ) 

and call

$this->model->savemany($this->request->data['student']); 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -