Re: Variables don't pass... *sniff*

From: Date: Wed, 28 May 2003 11:35:33 +0000
Subject: Re: Variables don't pass... *sniff*
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-149226@lists.php.net to get a copy of this message
To maintain absolute compatibility, just use $HTTP_GET_VARS. It's availalable in all PHP versions, just deprectaed in versions here $_GET is available. daniel@rhesusb.dk wrote:
Thank you! =) Okay, okay... Sorry to keep rambling on like this, but I just need to get this 100% straight: I read up on the predefined variables on php.net, and as you said, in older PHP versions, the $_GET equivalent was $HTTP_GET_VARS, and that did the same as $_GET. So, the RegisterGlobals boolean did exist in older versions too, but just now defaulted to false instead of true? Meaning, that my older scripts which used neither $HTTP_GET_VARS nor $_GET will infact fail on all versions where RegisterGlobals is false. Is that correct? So, to maintain absolute compatibility, I'll just have to check if either $_GET[aVar] or $HTTP_GET_VARS[aVar] is set and get the value from the existing one? Again, thanks for the help =) Daniel ----- Original Message ----- From: Petre Agenbag To: daniel@rhesusb.dk Cc: php-general@lists.php.net Sent: Wednesday, May 28, 2003 12:02 PM Subject: Re: [PHP] Variables don't pass... *sniff* Sorry, I missunderstood your question about backwards compatible. YES, accessing your variables this way ($_POST[] etc), IS backwards compatibel, ie, they are placed in those arrays anyways, BUT, the method is not backwards compatible to older versions of PHP, there the arrays were called $HTTP_GET_VARS or something similarly unlike $_GET... On Wed, 2003-05-28 at 11:49, daniel@rhesusb.dk wrote: Thank you mate, this works! =) Just curious, though... I'd like to keep my scripts as compatible as possible, so can you tell me if this method is backwards compatible? I've never used this method before, the variables have just "been there" on a subsequent page. I'm kinda fearing for my previous work, if the servers suddenly change their configurations, rendering scripts non-functional... And, I'm guessing $_POST would be the array to hold POSTed variables, right? Is there a function to "release" the contents of these arrays into global variables in a scripts, so you don't have to go...
    $var1 = $_GET[var1];
    $var2 = $_GET[var2];
...if that's what you wanted? (Not sure I want to, but just to know) Again, thank you! =) Daniel ----- Original Message ----- From: Petre Agenbag To: daniel@rhesusb.dk Cc: php-general@lists.php.net Sent: Wednesday, May 28, 2003 11:40 AM Subject: Re: [PHP] Variables don't pass... *sniff* RegisterGlobals = Off You need to access these variables by $_POST[aVariable] or in your case ( adding the variables to the end of a URL means you are using the GET method: $_GET[aVAriable] etc. On Wed, 2003-05-28 at 11:37, daniel@rhesusb.dk wrote:
Hi all! I'm using Apache 2.0.45, PHP 4.3.2RC4, and MySQL 3.23.49 on Windows 2003 Server Standard. I have a problem passing variables between pages. They simply get lost. Neither GET nor POST pass values, and even "hardcoding" them into the URL, like htpp://localhost/comeon.php?aVariable=ding&anotherVariable=dong and putting this in comeon.php: echo("Values: $aVariable, $anotherVariable"); only outputs Values: , ...I've tried with RC3 of PHP, even 4.3.1, but it doesn't work. I've used PHP on my machine with Apache 2 before, and it worked fine. Actually I
used
the same scripts fine on my old config. This was on XP however, so I'm not sure if it's got something to do with the OS. I'm hoping it's a configuration issue. Any ideas are VERY much appreciated =). Thanks, Daniel » There are 10 kinds of people - those who know binary and those who
don't.
«
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.

« previous php.general (#149226) next »