Link to home
Start Free TrialLog in
Avatar of polaughlin
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?
Avatar of Timelib
Timelib

I've done the same code, but not in a echo command.

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.
Avatar of polaughlin

ASKER

Does not work.
Does not work.
ASKER CERTIFIED SOLUTION
Avatar of Timelib
Timelib

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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
Very informative.  I totally understand now.  Sorry I can't give you any points, majorspank.