After the check box is submitted to the client, how does the server process the checked query submitted by the client? -Php Tutorial

Source: Internet
Author: User
After the check box is submitted to the client, how does the server process the checked query submitted by the client? For example, if I select, 5
On the server side, how can I obtain products, 5, and how many other models are available.
The database field is the kid, lb, and xh values in the table. The model contains only three values: large, medium, and small.

Also, how do I check and submit data after paging.
For example, on the first page, I checked 3, 4, 5, and 3, 8, 9, and 12 on the second page. because the page is displayed, I need to check the page and how to submit the data after checking the page, please kindly advise ..


Reply to discussion (solution)

Set the value to kid.

The server obtains the selected kid.
$ KidList = $ _ POST ['check'];
Use these IDs to find data from the database

To retrieve data by page, you can use get to include the parameter. If the data volume is small, it is easier to switch pages using JS.

Simply save the paging parameters to the session.

Set the value to kid.

The server obtains the selected kid.
$ KidList = $ _ POST ['check'];
Use these IDs to find data from the database

To retrieve data by page, you can use get to include the parameter. If the data volume is small, it is easier to switch pages using JS.

Through these IDs, how can we make tea in the database ..
Select * from table where kid = ¥ kid
However, if you have selected several options, how to write them ..

Set the value to kid.

The server obtains the selected kid.
$ KidList = $ _ POST ['check'];
Use these IDs to find data from the database

To retrieve data by page, you can use get to include the parameter. If the data volume is small, it is easier to switch pages using JS.
How can I use the get method? please advise me...

$ Kid = join (',', $ _ POST ['kid'])
$ SQL = "select * from table where kid in ($ kid )";

1. First, we should consider adding or enhancing the search function and try to exclude irrelevant data display.
2. you can also set how much data is displayed on each page to display as much data as possible.
The above two methods can be used to avoid such problems.

If there is no way to avoid using a similar "shopping cart" processing method, save the data selected by the user to the cookie or session
You only need to "add to shopping cart" and "confirm payment. Parameter passing through GET is not recommended.

In fact, the most important thing is how to name the name attribute of your checkbox. different names are passed to different variables.
It is best to use an array name. js is organized into an array or a list for submission in onSubmit.

As for paging, we recommend that you use p + hide to change pages, so that you can keep changing pages in the same form.
You can also use ajax for page feed. if ajax is used, it will be submitted by the way every time the page is changed. The php end will temporarily submit the page and compute the page after the summary.

We recommend that you read more open-source code and have basic knowledge.
Simple statements such as SQL statement select in should be understood below

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.