polaughlin
asked on
Problem getting variables in URL
index.php:
<? echo "test is: $test"; ?>
If I call the page via:
http://myhost/index.php?test=hey
Shouldn't it return:
test is: hey
All I get is:
test is:
Is something wrong with my installation? If so, what can I do to fix this?
<? echo "test is: $test"; ?>
If I call the page via:
http://myhost/index.php?test=hey
Shouldn't it return:
test is: hey
All I get is:
test is:
Is something wrong with my installation? If so, what can I do to fix this?
ASKER
Does not work.
ASKER
Does not work.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Alright. Register_globals in php.ini was set to Off.
Changing it to On fixed the problem. Is there something seriously wrong with changing this to On?
Thanks for your help.
Changing it to On fixed the problem. Is there something seriously wrong with changing this to On?
Thanks for your help.
ASKER
I'd appreciate an answer to my last question. Here's some more points.
The following link gives a decent opinion on why register_globals should be Off.
http://www.securiteam.com/securityreviews/6P00G2A3FG.html
http://www.securiteam.com/securityreviews/6P00G2A3FG.html
ASKER
Very informative. I totally understand now. Sorry I can't give you any points, majorspank.
I usually put it into a variable, then echo or use it.
$TestVar = "Test is: $test";
echo $TestVar;
However, try to this to make sure you are passing URL GET variables.
echo "Test is:" . $test;
Should work, I use it all the time.