gotornot Posted December 21, 2010 Share Posted December 21, 2010 Hi I am trying to get all variables passed in a url string and wondered how would i do it? I dont know what they are yet and i need to set key as value. Any help? Quote Link to comment https://forums.phpfreaks.com/topic/222320-getting-any-variables-passed-in-a-url-string/ Share on other sites More sharing options...
Pikachu2000 Posted December 21, 2010 Share Posted December 21, 2010 $_SERVER['QUERY_STRING'] would hold all those values. Quote Link to comment https://forums.phpfreaks.com/topic/222320-getting-any-variables-passed-in-a-url-string/#findComment-1149997 Share on other sites More sharing options...
peterbarone Posted December 21, 2010 Share Posted December 21, 2010 do you mean like this <a href="EDIT.php?id=2">submit id 2</a> then get it from the url on the edit page $id = $_GET['id']; Quote Link to comment https://forums.phpfreaks.com/topic/222320-getting-any-variables-passed-in-a-url-string/#findComment-1150065 Share on other sites More sharing options...
taquitosensei Posted December 21, 2010 Share Posted December 21, 2010 This is a bad idea and a huge security hole. This used to be done automatically. It was called register_globals. They turned it off by default for a reason. You could duplicate it with this. foreach($_GET as $k=>$v) { $$k=$v; } Quote Link to comment https://forums.phpfreaks.com/topic/222320-getting-any-variables-passed-in-a-url-string/#findComment-1150070 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.