RE: [PHP] Pulling variables from a URL
| From: | Carl Furst | Date: | Tue, 14 Oct 2003 17:58:37 +0000 |
| Subject: | RE: [PHP] Pulling variables from a URL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-166095@lists.php.net to get a copy of this message | ||
If you are using the variable $username as a variable variable type thing..
like you don't know what username is going to be each time...
Use double quotes:
$_GET["$username"];
that will make PHP interpolate the variable and use whatever value $username
is as the name of the $_GET var. Single quotes ''' tells PHP 'take the
$tring as is and don't interpolate anything'
you HAVE to do that.. you can't do... if you have the register_globals
directive on for example ${$username}.. no no no. Doesn't like that.
double quotes say "interpolate $variables". However I have discovered (at
least in php 4.2.3) that you cannot use subarrays in double quotes like "my
var in the subarray subarray: $array['subarray']['subarray']" That
doesn't
seem to work.. it comes up blank.
Carl Furst
-----Original Message-----
From: Frank Tudor [mailto:frank_tudor@yahoo.com]
Sent: Tuesday, October 14, 2003 1:16 PM
To: php-general@lists.php.net
Subject: [PHP] Pulling variables from a URL
I have a URL including variables... It looks like this:
http://registration.php?username=111111&email=test@test.com
But I can't pullit into the next page's form
Here is what is in the form and other things I have tried:
$username = $_HTTP_POST_VARS['username'];
echo $_GET['$username'];
echo $_POST['$username'];
This page sumbits with PHP_SELF if that helps with this puzzle.
Can someone tell me what I'm doing wrong?
Also I do have an include file that looks for session
information but Ihave disabled it to see if I can pass
variables.
Frank
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php