About PHP get post parameters

Source: Internet
Author: User
First Contact PHP things, want to ask, I front-end HTML, with get submitted data, the address bar is like this:
..../.. &a=good_1&b=200&a=good_2&b=300&a=good_4&b=400

Use $_get to get parameter values in PHP files, using foreach ($_request as $key = = $value)
But can only get to the last one, namely a=good_4&b=400, the other two get not to, this How to solve?


Reply to discussion (solution)

Your key is repeated.

Because the URL parameter string violates the PHP convention (the incoming variable with the same name is in the form of an array), it cannot be taken
You can parse it yourself from $_server[' query_string '.

This is not a key duplication problem.
..../.. &a[]=good_1&b[]=200&a[]=good_2&b[]=300&a[]=good_4&b[]=400
This will be desirable to the value

Your key is repeated.

Your reference field except A is B ah, obviously repeated

The parameters are repeating.

The name of the parameter is repeated, of course it will be overwritten.

&a=good_1&b=200 &a=good_2&b=300 &a=good_4&b=400
The parameters are repeated and will of course be overwritten at the end. You can use an array to pass or change the parameter name.
For example:
&a[]=good_1&b[]=200&a[]=good_2&b[]=300&a[]=good_4&b[]=400

Array (    [0] = Good_1    [1] = Good_2    [2] = good_4) Array (    [0] =    [1]    + [2] = 400)

Because the URL parameter string violates the PHP convention (the incoming variable with the same name is in the form of an array), it cannot be taken
You can parse it yourself from $_server[' query_string '.


Moderator is such as and to PHP understand so thin oh???
  • Related Article

    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.