PHP, how do I traverse the form and write to the database?

Source: Internet
Author: User
There is a style for:

To write the values of the four IDs into a single data table, how do I write php?


Reply to discussion (solution)

No way! You're violating the rules.
You can only get the last $_post[' ID ']

 
  $value) {//Loop Insert Database}}?>
 
  No title

How does the Foreach Loop body work? You mean, I understand, it's just a little bit of a bad idea.

 
  $value) {//Loop Insert Database}}?>
 
  No title

How does the Foreach Loop body work? You mean, I understand, it's just a little bit of a bad idea.

How does the Foreach Loop body work? You mean, I understand, it's just a little bit of a bad idea.

foreach ($_post[' id '] as $key = = $value) {mysql_query ("INSERT into table name (XXX) VALUES ($value)");}

Now I like $ ("form"). Serialize () Take all the form elements directly ...

Now I like $ ("form"). Serialize () Take all the form elements directly ...
Even if you can directly take the past, but the background is to correspond to the value, or not to plug the database.


How does the Foreach Loop body work? You mean, I understand, it's just a little bit of a bad idea.

foreach ($_post[' id '] as $key = = $value) {mysql_query ("INSERT into table name (XXX) VALUES ($value)");}


Thank you, I tried, you can pass in the single-dimension array, and now I have a two-dimensional array, that is, a list of two name values need to pass in, alas, for example, I need to pass an ID and a title to go in,
can modify $_post[' id ' [' title '] as .....
Is that OK? Hero, do you have this information, can you share it?

Is that OK? Hero, do you have this information, can you share it?
is to look at the manual development of the idea is clear, the idea is the most important to see how you pass the value of it, or you, you want to send me a page to see me write it for you


Is that OK? Hero, do you have this information, can you share it?
is to look at the manual development of the idea is clear, the idea is the most important to see how you pass the value of it, or you, you want to send me a page to see me write it for you

Elder, can you leave a contact way (mailbox), younger brother grateful

Elder, can you leave a contact way (mailbox), younger brother grateful
I'm a qq787574729, too. Common progress

  • 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.