deaf_jupiter Posted October 13, 2006 Share Posted October 13, 2006 Hi,I came up this problem today:I tried to pass a variable to a script creating a URL like:article.php?id=25Unfortunately it appears $id is quite empty. Is there some setting I need to alter?It used to work in the past (php4 that is).Also, I don't have great access to the settings so is there also a workaround besides changing the ini file?Thank you in advance! Quote Link to comment https://forums.phpfreaks.com/topic/23840-passing-vars-over-url/ Share on other sites More sharing options...
heckenschutze Posted October 13, 2006 Share Posted October 13, 2006 now the query string is parsed into "SUPERGLOBALS"The ?GET query string can be accessed with the SuperGlobal $_GET (Array)eg.[code]<?php$id = $_GET["id"];echo $id;?>[/code]This was changed because from earlier versions of PHP for security and performance concerns. POST vars are now stored in $_POST :)hth..NOTE: you can also turn on the 'old skool' methods in php.ini Quote Link to comment https://forums.phpfreaks.com/topic/23840-passing-vars-over-url/#findComment-108272 Share on other sites More sharing options...
redbullmarky Posted October 13, 2006 Share Posted October 13, 2006 register_globals is (rightly) turned off in your PHP.ini file - and should remain that way.to get the contents of id in the URL, use $_GET['id'][b]edit:[/b] beat me to it :) Quote Link to comment https://forums.phpfreaks.com/topic/23840-passing-vars-over-url/#findComment-108274 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.