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! 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 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 . 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. 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
Archived
This topic is now archived and is closed to further replies.