;

PDA

Click to See Complete Forum and Search --> : PHP script does not understand the variables from the URL?


mikaelian
04-16-2007, 05:48 PM
PHP script does not understand the variables from the URL?

Hello, can you please help me with the following very strange problem? It is the first time I ever see a problem like this: the PHP script does not understand the variables passed to it by URL. To explain the point I made a very simple script test.php consisting of the text:

<?php
echo $signal;
?>

So if we call this script by browser as:
www.MyServer.com/test.php?signal=777
then it need output the text “777”. However, it does not do that.

To test if PHP in general works on this server I made another simple script like:

<?php
$signal = 888;
echo $signal;
?>

Which DID output the text “888”

Can somebody have an idea what is the problem?

Thank you!

nunomira
04-16-2007, 08:12 PM
hi,

That will only work if register_globals (http://pt2.php.net/manual/en/ini.core.php#ini.register-globals) is turned on. If it isn't, which has been the default for some years now (due to security reasons), you need to grab the variable from the $_GET array:

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

mikaelian
04-17-2007, 04:02 AM
Thank you very much! It worked.