Page 1 of 1

Super Globals... Why returnung blank in all ...

Posted: Tue Dec 31, 2002 8:24 am
by PingLeeQuan
Good Morning .... I am sorry if this is a repeat question or if it is so simple to some. I searched the usergroup but i could not find the answer.

--My register_globals are turned off.

--I am using PHP4.3


--Page index.php is calling itself and passing a URI parameter in the url string (http://www.abcd.com/index.php?testSTR=aboutus).

--All i am trying to do is get the value of the testSTR. I tried all superglobal value with no use. I read Jason's article but it still does not work for this one.

Any help is greatly appreciated.


When i display the the following, it all displays blanks...

echo $HTTP_SERVER_VARS['iam']
echo $HTTP_SERVER_VARS['$iam'];
echo $HTTP_SERVER_VARS[$iam];

echo $_SERVER['iam'];
echo $_SERVER['$iam'];
echo $_SERVER[$iam];

echo $_POST['iam'];
echo $_POST['$iam'];
echo $_POST[$iam];

Is there anything el;se that has to be turned on with PHP4.3???

thanks again

Posted: Tue Dec 31, 2002 8:42 am
by PingLeeQuan
OK... I turned register_globals on and it seems to be working. My quesation remains, why is it that we have to turn on register globals if we are supposed to accomplish teh same thing by using the $_POST, $_GET, $_SERVER,..... that came to replace the register globals?!

Isn't it a security issue that register_globals are turned off?

Again, sorry for the simplicity of this question.

--quan

Posted: Tue Dec 31, 2002 8:42 am
by Bill H
It's in the $_GET array, as in

Code: Select all

<?php
if ($_GET['testSTR'] = whatever)
{     // whatever
}
?>
You will also fond it in $_REQUEST

Posted: Tue Dec 31, 2002 8:45 am
by kcomer
Read this, it will explain all, or it will try to at least.
http://www.php.net/manual/en/language.v ... efined.php
Have a good new year.

Posted: Tue Dec 31, 2002 8:45 am
by Rob the R
Did your echo examples mean to refer to "testSTR" instead of "iam" for the variable name? "iam" certainly will not be set if the URI refers to "testSTR". Try:

Code: Select all

echo $_GET&#1111;'testSTR']
When you pass parameters using the "URL?var=value" syntax, this uses the "get" method so the parameters will be stored in the $_GET array.

Posted: Tue Dec 31, 2002 9:46 am
by PingLeeQuan
you are right rob.. i meant to say testSTR instead of iam.

i am reading the link that kcomer sent... will let you know if the this works...