TheNix Posted February 22, 2009 Share Posted February 22, 2009 So I want a page to discover any passed variables from any source (post, get, cookies). I don't know what the variable names are that will be passed. How do I get the names and values? If you can show me an example of post i can probably apply the same method for get and cookies. Thank you. Link to comment https://forums.phpfreaks.com/topic/146410-solved-finding-unknown-passed-variables/ Share on other sites More sharing options...
DeanWhitehouse Posted February 22, 2009 Share Posted February 22, 2009 erm something like $vars = $_REQUEST; foreach($var as $key => $vars) { echo "Passed Name: ".$key."; Value: ".$vars; } Link to comment https://forums.phpfreaks.com/topic/146410-solved-finding-unknown-passed-variables/#findComment-768696 Share on other sites More sharing options...
TheNix Posted February 22, 2009 Author Share Posted February 22, 2009 Thank you very much Link to comment https://forums.phpfreaks.com/topic/146410-solved-finding-unknown-passed-variables/#findComment-768700 Share on other sites More sharing options...
TheNix Posted February 22, 2009 Author Share Posted February 22, 2009 actually I'm getting nothing and I'm just slapping <?php ?> on it. The code is working but nothing is being passed. I'm using post method Link to comment https://forums.phpfreaks.com/topic/146410-solved-finding-unknown-passed-variables/#findComment-768718 Share on other sites More sharing options...
Philip Posted February 22, 2009 Share Posted February 22, 2009 It should be: $vars = $_REQUEST; foreach($vars as $key => $var) { echo "Passed Name: ".$key."; Value: ".$var; } I prefer: echo '<pre>'; print_r($_REQUEST); echo '</pre>'; Although use of REQUEST can be iffy and unsecure (as with all user inputs) Link to comment https://forums.phpfreaks.com/topic/146410-solved-finding-unknown-passed-variables/#findComment-768719 Share on other sites More sharing options...
TheNix Posted February 22, 2009 Author Share Posted February 22, 2009 Ya that did it, thank you Link to comment https://forums.phpfreaks.com/topic/146410-solved-finding-unknown-passed-variables/#findComment-768724 Share on other sites More sharing options...
DeanWhitehouse Posted February 22, 2009 Share Posted February 22, 2009 O yeah sorry about that, i started writing then looked at the manual (php one) then started again :s print_f would be better than print_r ? Link to comment https://forums.phpfreaks.com/topic/146410-solved-finding-unknown-passed-variables/#findComment-768729 Share on other sites More sharing options...
Philip Posted February 22, 2009 Share Posted February 22, 2009 O yeah sorry about that, i started writing then looked at the manual (php one) then started again :s print_f would be better than print_r ? printf is for formatting a string, while print_r will return a human readable variable dump. Link to comment https://forums.phpfreaks.com/topic/146410-solved-finding-unknown-passed-variables/#findComment-768731 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.