Jump to content

Echoing all $_GET values


Karaethon

Recommended Posts

I am testing my app to server transport to verify everything is working, I need to write a loop that takes each value sent via GET and/or POST and then echo each key:value back, how do I step through the $_GET or $_POST and extract each to echo?

Something like this, but what?

<?php
/*I know this is not valid, is psedocoded*/
foreach($key in $_GET as $value){
  echo $key." = ".$value;
}
?>

 

Link to comment
Share on other sites

Ok, I was almost right on. I got it right except my foreach order was wrong.

<?php
foreach($_GET as $key => $value){
	echo $key." = ".$value;
}
?>

is the correct way. sorry for wasting space on the forum.

Link to comment
Share on other sites

I wasn't debugging so much as trying to verify that the app code was sending valid $_GET parameters. The app does all the data valiation, and I verified that side, I just needed to double check that what I 'thought' was being transmitted was what was actually being recieved. I don't have access to the recieving server so I was submitting to localhost to verify before actually submitting to server.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.