Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199908

RE: [PHP3] 2 variables deep From: John Coggeshall (someone <email protected>)
Date: 08/21/99

> I'm still new at PHP and am stuck on something simple.

Maybe I can help :)

> I want to create an Array of the QUERY_STRING variables from the previous
> page and then call them up.

Okay... There are easier ways to do this I suspect.

Assuming you have index.php3 and you want index.php3 to pass variables to
mypage.php3... say this:

http://www.mydomain.com/mypage.php3?dog=rover&cat=spot

in mypage.php3.. you can access the as:

echo $dog; // returns "rover"
echo $cat; // returns "spot"

(assuming you have track vars enabled in PHP3 and you are using the GET post
method as above) there is a a array of these values already created:

echo $HTTP_GET_VARS['dog']; // returns "rover"

Now... if you don't have $HTTP_GET_VARS available... at the very top of your
page before you define ANY other variables... do this:

while(list($key, $val) = each($GLOBALS))

        $myqueryarray['$key'] = $val;

Then you'll have the exact same thing as $HTTP_GET_VARS would have... in
fact... if you are switching between GET and POST a lot, you can use the
above method to save confusion.

Hope that helps.

John

-- 
PHP 3 Mailing List <http://www.php.net/>
To unsubscribe, send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest, e-mail: php3-digest-subscribe <email protected>
To search the mailing list archive, go to: http://www.php.net/mailsearch.php3
To contact the list administrators, e-mail: php-list-admin <email protected>