$_GET empty

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hyder_m29
Forum Newbie
Posts: 12
Joined: Mon Jun 23, 2008 9:36 am

$_GET empty

Post by hyder_m29 »

Php Url: www[dot]somewebsite[dot]com/feedback.php?url=feedback_empty.php

Php Relevant Code:

Code: Select all

if (trim($_GET['url']) == '')
      $navigateToUrl = "feedback_list.php";    // always gets here
else
      $navigateToUrl = $_GET['url'];
header("Location: $navigateToUrl");
Why is my $_GET['url'] always empty?
Php always loads feedback_list.php regardless of whether url parameter is set or not

register_globals is set to off... does that affect superglobals?
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: $_GET empty

Post by califdon »

Have you tried echoing the value of $_GET['url']?
hyder_m29
Forum Newbie
Posts: 12
Joined: Mon Jun 23, 2008 9:36 am

Re: $_GET empty

Post by hyder_m29 »

califdon wrote:Have you tried echoing the value of $_GET['url']?
Yes, its blank!
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: $_GET empty

Post by califdon »

...and yet, you can see it there in the URL? Hmmm. Can you test it on another, really simple script pair? If $_GET just isn't working, it must be the settings in your PHP configuration. I'm getting out of my depth there, so I hope someone else will be able to shed more light on this.
manixrock
Forum Commoner
Posts: 45
Joined: Sun Jul 20, 2008 6:38 pm

Re: $_GET empty

Post by manixrock »

try print_r()'ing the $_GET like this:

Code: Select all

print_r($_GET);
and write here both the URL and the resulting page.
gmapsuser
Forum Newbie
Posts: 5
Joined: Mon Jul 21, 2008 11:47 pm

Re: $_GET empty

Post by gmapsuser »

Which version of PHP are you using? If it is earlier than 4.1.0 then use $HTTP_GET_VARS variable instead.
User avatar
Apollo
Forum Regular
Posts: 794
Joined: Wed Apr 30, 2008 2:34 am

Re: $_GET empty

Post by Apollo »

gmapsuser wrote:Which version of PHP are you using? If it is earlier than 4.1.0 then use $HTTP_GET_VARS variable instead.
And on top of that, if your code above is inside a function, get access to the array inside your funcion by specifying global $HTTP_GET_VARS;
LSJason
Forum Commoner
Posts: 45
Joined: Mon May 12, 2008 4:43 pm

Re: $_GET empty

Post by LSJason »

On top of what everyone just said...that code is HORRIBLY insecure.
andychamberlainuk
Forum Newbie
Posts: 6
Joined: Mon Jul 28, 2008 7:15 pm

Re: $_GET empty

Post by andychamberlainuk »

try using $_REQUEST['url'] and see if that works
Post Reply