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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
PingLeeQuan
Forum Commoner
Posts: 58
Joined: Tue Sep 03, 2002 8:08 am

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

Post 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
PingLeeQuan
Forum Commoner
Posts: 58
Joined: Tue Sep 03, 2002 8:08 am

Post 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
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Post 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
Last edited by Bill H on Tue Dec 31, 2002 8:45 am, edited 1 time in total.
kcomer
Forum Contributor
Posts: 108
Joined: Tue Aug 27, 2002 8:50 am

Post 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.
Rob the R
Forum Contributor
Posts: 128
Joined: Wed Nov 06, 2002 2:25 pm
Location: Houston

Post 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.
PingLeeQuan
Forum Commoner
Posts: 58
Joined: Tue Sep 03, 2002 8:08 am

Post 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...
Post Reply