PHP: How do I traverse the form and write it into the database?

Source: Internet
Author: User
PHP: How do I traverse the form and write it into the database? There is a style:

How can I write the values in four IDs into a data table?


Reply to discussion (solution)

Impossible! You violated the rules.
You can only get the last $ _ POST ['id']

 $ Value) {// Insert database cyclically}?>
  No title

In a foreach loop, how does one operate the body? I understand what you mean, that is, the writing method is not quite familiar.

 $ Value) {// Insert database cyclically}?>
  No title

In a foreach loop, how does one operate the body? I understand what you mean, that is, the writing method is not quite familiar.

In a foreach loop, how does one operate the body? I understand what you mean, that is, the writing method is not quite familiar.

Foreach ($ _ POST ['id'] as $ key => $ value) {mysql_query ("insert into table name (xxx) VALUES ($ value )");}

Now I like $ ("form"). serialize () to directly remove all form elements...

Now I like $ ("form"). serialize () to directly remove all form elements...
Even if it can be taken directly, the background still needs to pass the corresponding value, otherwise the database will not be inserted.


In a foreach loop, how does one operate the body? I understand what you mean, that is, the writing method is not quite familiar.

Foreach ($ _ POST ['id'] as $ key => $ value) {mysql_query ("insert into table name (xxx) VALUES ($ value )");}


Thank you. I tried to pass in a single-dimension array. now I have a two-dimensional array, that is, a list with two name values to be passed in. Alas, for example, if I want to upload an ID and a TITLE,
You can modify $ _ POST ['id'] ['title'] .....
Can this happen? Do you have any information about this? can you share it?

Can this happen? Do you have any information about this? can you share it?
The idea of manual development is clear. The idea is the most important. how do you pass the value? why don't you send it to me on the page you want to upload? I'll help you write it out.


Can this happen? Do you have any information about this? can you share it?
The idea of manual development is clear. The idea is the most important. how do you pass the value? why don't you send it to me on the page you want to upload? I'll help you write it out.

Elder brother, can I leave a contact information (email)? I am very grateful.

Elder brother, can I leave a contact information (email)? I am very grateful.
I am also a novice qq787574729.

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.