Page 1 of 1

$_GET empty

Posted: Mon Jul 21, 2008 3:27 pm
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?

Re: $_GET empty

Posted: Mon Jul 21, 2008 3:58 pm
by califdon
Have you tried echoing the value of $_GET['url']?

Re: $_GET empty

Posted: Mon Jul 21, 2008 5:51 pm
by hyder_m29
califdon wrote:Have you tried echoing the value of $_GET['url']?
Yes, its blank!

Re: $_GET empty

Posted: Mon Jul 21, 2008 7:34 pm
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.

Re: $_GET empty

Posted: Mon Jul 21, 2008 8:06 pm
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.

Re: $_GET empty

Posted: Tue Jul 22, 2008 1:11 am
by gmapsuser
Which version of PHP are you using? If it is earlier than 4.1.0 then use $HTTP_GET_VARS variable instead.

Re: $_GET empty

Posted: Tue Jul 22, 2008 1:37 am
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;

Re: $_GET empty

Posted: Tue Jul 22, 2008 9:13 am
by LSJason
On top of what everyone just said...that code is HORRIBLY insecure.

Re: $_GET empty

Posted: Mon Jul 28, 2008 7:25 pm
by andychamberlainuk
try using $_REQUEST['url'] and see if that works