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

Source: Internet
Author: User

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.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.