Forum Moderators: coopster

Message Too Old, No Replies

accessing parameter & post data with the same key name.

         

nelsonm

5:04 am on Dec 24, 2011 (gmt 0)

10+ Year Member



Hi all,

I'm passing some data to a php script from a web client using the same key id. The first as a parameter to a php script call 'php/items-se-script.php?data={"SSID":"12"}' via the GET method and the other 'data={"MMID":"44"}' by the the POST method.

I firebug, the parameters tab shows only 'data {"SSID":"12"}' and the post tab shows only 'data {"MMID":"44"}'.

I assume that i can only get data {"SSID":"12"} via the $_GET php function and data {"MMID":"44"} only via the $_POST function?

Is it also possible to get both using the $_REQUEST['data'] function even though the keys are the same?

penders

2:33 pm on Dec 24, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Using $_GET and $_POST arrays would be preferred over $_REQUEST anyway, but yes, you will need to access both these arrays in this instance.

I think the $_POST['data'] value will override the $_GET['data'] value in the $_REQUEST array by default, although the order in which these values are processed are controlled by the variables_order [php.net] and request_order [php.net] directives.

nelsonm

2:59 pm on Dec 24, 2011 (gmt 0)

10+ Year Member



thanks, have a great holiday from us in the USA.