Forum Moderators: coopster

Message Too Old, No Replies

Server problem?

So simple - why won't this work?

         

WebWalla

10:00 pm on Dec 29, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm in the middle of changing servers, and what works on my old one, doesn't work on the new one, even though PHP itself is working fine (phpinfo shows as much)

I want to pass a simple variable in the following way - http://www.example.com/test.php?foo=hello, and I'm using the following code ...


<html>
<head>
<title>Foo</title>
</head>
<body>
<?php
echo $foo;
?>
</body>
</html>

Could a server problem, or a PHP configuration issue, prevent this from working (I get a blank page)?

What troubleshooting could I do to solve this?

Thanks.

PHP_Chimp

10:04 pm on Dec 29, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



http://www.example.com/test.php?foo=hello
...
<?php
echo $foo;
?>

Is assuming that register_globals is on.
Try -

<?php
echo $_GET['foo'];
?>

As this doesnt rely on globals being on. The default is for this to be off, as there are a lot of serious security problems with register_globals being on.

<edit>
As for troubleshooting...you could completely undermine any security on your server by changing php.ini to allow globals...or change your code.

[edited by: PHP_Chimp at 10:08 pm (utc) on Dec. 29, 2007]

WebWalla

11:29 pm on Dec 29, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Working - thanks a lot!