NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
PHP _GET() function not working


Joined: 01 Nov 2010
Posts: 2
Reply with quote
I have a page that has a URL with some GET data (http://wherever.com?dataname=datavalue). In the target page I am trying to use the _GET(dataname) but it is empty.

lil help please?
View user's profileFind all posts by atsgjonSend private message


Joined: 11 Apr 2010
Posts: 90
Location: Prague, Czech Republic
Reply with quote
You need to use $_GET['dataname'].
View user's profileFind all posts by fibizaSend private message


Joined: 01 Nov 2010
Posts: 2
Reply with quote
sorry, typo, I have tried $_GET[dataname], $_GET["dataname"], and $_GET['dataname'].
View user's profileFind all posts by atsgjonSend private message


Joined: 11 Apr 2010
Posts: 90
Location: Prague, Czech Republic
Reply with quote
$_GET["dataname"] and $_GET['dataname'] are the same, they just use different type of quotes. However they should both work. I can think of only a few situations, when the variable would be empty.
1) You unset the variable using unset($_GET['dataname']) earlier in the script or overwrite it with NULL value (or empty string, etc.)
2) You have register_globals = on (PHP setting) and
a) you overwrite it by $dataname variable earlier in the script
b) it is overwritten by other variable from $_POST, or $_COOKIE
3) You have an internal redirection in your .htaccess file that strips the parameters
4) You have an the same redirection as in 3) but directly in .htconf of you Apache server or IIS equivalent of this
I can think of no other situation (save corrupted PHP) how this could happen otherwise. If possible I suggest you to use echo ini_get('register_globals') to check 2) and see if they are on. Then I would suggest to use var_dump($_GET) to see if your 'dataname' exists, is empty string, NULL, or otherwise. If it exists but is empty, it means it has been overwritten by empty value (NULL). If it does not exist, it means that it ether has been unset or it has never been registered, which would point me to 3) or 4). Together with this and verification of your code before using the variable you should be able to pinpoint the problem.
View user's profileFind all posts by fibizaSend private message


Joined: 18 Dec 2014
Posts: 1
Reply with quote
what URL do you use for the window? Are you aware of current URL (document location) the script is running on?
Just put alert with URL location you're trying to open Smile
Most probably URL is wrong and therefore won't open.



_________________________________________
View user's profileFind all posts by rareSend private message
PHP _GET() function not working
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic