How does PHP add a single form item by clicking the Add button, insert all the content to the database, and add a single form
How does PHP Add a form entry by clicking the "add" button and insert all content to the database?
You can see this question on Baidu and want to answer it. The result is as follows:
Html + jquery:
<Html>
Exe. php
<? Php $ arr_time = $ _ POST ['data'] ['time']; $ arr_grade = $ _ POST ['data'] ['case']; $ arr_type = $ _ POST ['data'] ['type']; for ($ I = 0; $ I <count ($ arr_time); $ I ++) {$ insert [$ I] ['time'] = $ arr_time [$ I]; $ insert [$ I] ['grad'] = $ arr_grade [$ I]; $ insert [$ I] ['type'] = $ arr_type [$ I];} echo "<pre>"; print_r ($ insert ); echo "</pre> "; /* each data is a data Array ([0] => Array ([time] => November 7, 2014 15:50:18 [grade] => 1 [type] => sanhaosheng) [1] => Array ( [Time] => November 7, 2014 15:50:24 [grade] => 2 [type] => Excellent student) [2] => Array ([time] => November 7, 2014 15:50:27 [grade] => 1 [type] => sanhaosheng) */?>
You should know how to do the result.