Jump to content


Photo

PHP 4.0.4pl1 passing variables via url disabled?


  • Please log in to reply
2 replies to this topic

#1 eisdrache

eisdrache
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 09 May 2006 - 06:47 PM

I have been writing PHP5 for quite some time now without any problems. So, I know how to pass variables via url.

However, I recently began doing some work on an older server that is running PHP 4.0.4pl1 and it will not recogize any of my variables that I pass via the url.

Here is an example of some code that works perfectly on the server running PHP5 but does not work on the server running PHP 4.0.4pl1:

-------------
www.example.com/index.php?data=nodata

$data = "confused";

if ( $_GET['data'] ) {
if ( $_GET['data'] == "nodata" ) $data = "nodata";
else if ( $_GET['data'] == "all" ) $data = "all";
}

echo $data; // returns "confused"
-------------

Is this a known issue with PHP 4.0.4pl1 or is there something amiss in my php.ini file?

Thanks in advance for any help.

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 09 May 2006 - 07:01 PM

You can't use those global arrays until 4.1.

Before that you have to use $HTTP_GET_VARS['varname'], $HTTP_POST_VARS['varname'], etc.

EDIT: reference: [a href=\"http://us2.php.net/manual/nl/reserved.variables.php\" target=\"_blank\"]http://us2.php.net/manual/nl/reserved.variables.php[/a]

Info: PHP Manual


#3 eisdrache

eisdrache
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 09 May 2006 - 07:22 PM

great, thanks for the help.

I can't believe how many times I actually looked at that article at php.net and still couldn't figure out the answer (my ADD must have been kickin in really bad).

Anyway, thanks again.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users