chantown Posted November 20, 2008 Share Posted November 20, 2008 Hello, Does anybody know how to find the GET variable? www.domain.com?UNKOWN=255 Is there a way to figure out what Unknown is (using some method?) and also get the value? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/133560-how-to-find-the-get-variable/ Share on other sites More sharing options...
marcus Posted November 20, 2008 Share Posted November 20, 2008 $var = $_GET['unkown']; http://domain.com/file.php?unkown=255 Quote Link to comment https://forums.phpfreaks.com/topic/133560-how-to-find-the-get-variable/#findComment-694705 Share on other sites More sharing options...
premiso Posted November 20, 2008 Share Posted November 20, 2008 The only way I can think of is doing a foreach loop <?php foreach ($_GET as $key => $val) { echo $key . " = " . $val . "<Br />"; } ?> You may also be able to use $_SERVER['QUERY_STRING'] echo $_SERVER['QUERY_STRING']; Than using explode you should be able to pull out the name. Or instead of explode you can use parse_str . Quote Link to comment https://forums.phpfreaks.com/topic/133560-how-to-find-the-get-variable/#findComment-694706 Share on other sites More sharing options...
Maq Posted November 21, 2008 Share Posted November 21, 2008 I'm assuming UNKNOWN isn't the actual name? You would have to loop through like premiso said. This will give you the values for any GET method variable in the URL. Quote Link to comment https://forums.phpfreaks.com/topic/133560-how-to-find-the-get-variable/#findComment-694853 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.