Jump to content

Variables in URL not passing to PHP


ejaboneta

Recommended Posts

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

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.

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']; ?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.