ejaboneta Posted March 6, 2009 Share Posted March 6, 2009 Everything was working fine and then suddenly the varibles in the URL were not being passed. I tried creating a test page to test it and it didnt work there either. I emailed my host and they said it was working fine and after that it did. I thought it might be my browser settings and whatnot but then I had other people tell me they experienced the same thing when it was happening to me. Is there a reason this could have happened? The host said there was no server side reason for it. I just don't want it to happen again. If I wasn't clear, the script would say <?php echo $a; ?> The url would be http://site.com?a=hello and there would be no output. Link to comment https://forums.phpfreaks.com/topic/148295-variables-in-url-not-passing-to-php/ Share on other sites More sharing options...
revraz Posted March 6, 2009 Share Posted March 6, 2009 It's possible your code relied on Register Globals being on and someone turned them off. Are you using $_GET in your code or do you rely on register globals? Link to comment https://forums.phpfreaks.com/topic/148295-variables-in-url-not-passing-to-php/#findComment-778540 Share on other sites More sharing options...
redarrow Posted March 7, 2009 Share Posted March 7, 2009 try it. <?php echo $_GET['a']; ?> Link to comment https://forums.phpfreaks.com/topic/148295-variables-in-url-not-passing-to-php/#findComment-778641 Share on other sites More sharing options...
ejaboneta Posted March 7, 2009 Author Share Posted March 7, 2009 everything is working now so I can't really test anything. The site does rely on register globals but the host is supposed to have it on. I suppose I can just forget it until it happens again. Link to comment https://forums.phpfreaks.com/topic/148295-variables-in-url-not-passing-to-php/#findComment-778813 Share on other sites More sharing options...
PFMaBiSmAd Posted March 7, 2009 Share Posted March 7, 2009 You should not be using register_globals. They were depreciated and turned off by default in php4.2 in the year 2002 and they have completely been removed in php6. You will have a rude surprise when your scripts stop working under php6 and must be rewritten. Link to comment https://forums.phpfreaks.com/topic/148295-variables-in-url-not-passing-to-php/#findComment-778818 Share on other sites More sharing options...
kristofferlc Posted March 7, 2009 Share Posted March 7, 2009 If you actually made your code work: <?php echo $a; ?> It's the very first time i've seen php being able to use a normal variable to answer to a GET value... But i would follow redarrow's surgetstion and use his code instead: <?php echo $_GET['a']; ?> Link to comment https://forums.phpfreaks.com/topic/148295-variables-in-url-not-passing-to-php/#findComment-778827 Share on other sites More sharing options...
alphanumetrix Posted March 7, 2009 Share Posted March 7, 2009 becareful with passing variables through URL; especially when using $_GET - it can make your script vulnerable. Link to comment https://forums.phpfreaks.com/topic/148295-variables-in-url-not-passing-to-php/#findComment-778844 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.