RE: [PHP] How to pass on a variable with a page request
| From: | Lawrence dot Sheed at dfait-maeci dot gc dot ca | Date: | Wed, 22 Nov 2000 01:56:55 +0000 |
| Subject: | RE: [PHP] How to pass on a variable with a page request | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-26562@lists.php.net to get a copy of this message | ||
You may have configured php too safely!
There is an order to the way variables get read in php - variable
precedence.
You can receive variables from Cookies, from Form posts, gets etc, internal
(ie $x=1; within code)
Its possible you've set the order a different way
I would first try passing the url to a test file eg
test.php
<?
print "<br>GET:".$HTTP_GET_VARS ("user");
print "<br>POST:".$HTTP_POST_VARS ("user");
print "<br>INTERNAL:".$user;
?>
From the browser
test.php?user=loz
and seeing if the value appears correctly in any of those lines (on the get
most probably)
If it does, you can either change your php settings for order of precedence,
or add something like the following to the top of your code.
if (isset($HTTP_GET_VARS))
{
while(list($name,$value) = each($HTTP_GET_VARS))
{
$$name = $value;
};
if (isset($HTTP_POST_VARS))
{
while(list($name,$value) = each($HTTP_GET_VARS))
{
$$name = $value;
};
};
-----Original Message-----
From: Brian Clark [mailto:brianj@fusionwerks.com]
Sent: November 22, 2000 06:03 AM
To: Bruno Tersago
Cc: php-general@lists.php.net
Subject: Re: [PHP] How to pass on a variable with a page request
Hello Bruno,
(BT == "Bruno Tersago") bruno@fhw.gr writes:
BT> I'm a newbie to PHP and I already ran into trouble after the first test.
I
BT> was following the article written by Kevin Yank on Webmasterbase.
BT>
BT> When I want to pass along a variable via a page request, things go
wrong:
BT> In the HTML file I write:
BT>
BT> <a href="click.php?name=Bruno"> Hi , my name is Bruno </a>
BT>
BT> In the PHP file, I only see
BT>
BT> Welcome, !
I'm assuming you have:
Welcome, <? echo $name; ?>!
In the "PHP file," right?
BT> whereas I expected to see the name appear (invoked by $name).
BT> I can see it in the URL but not in the page.
BT>
BT> Any ideas why?
BT> Oh yes, I use SUSE Linux, Apache 1.3 and PHP4. So far no complaints
during
BT> installation.
-Brian
--
Computers are useless. They can only give you answers. --Pablo Picasso
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net