468,315 Members | 1,414 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,315 developers. It's quick & easy.

greenhorn question

Hello PHP gurus,

I start learning PHP a couple of days ago. I am running PHP 4. on Red Hat 9.
Look like things are setup correct. I have no problem running since script
like
<?
phpinfo();
?>.

However, I can't get the any variable output from the following, whether
clicking on the "Test" or not. $QUERY_STRING, $Year, and $Month are always
empty.

File test1/php:

<html>
<head>
<title></title>
</head><body>
<?
echo "QUERY_STRING = $QUERY_STRING <br>\n";
echo "Year = $Year<br>\n";
echo "Month = $Month<br>\n";
echo "<a href=\"./test1.php?Year=2005&Month=1\">Test</a>";
?>
</body></html>

Please help. Thanks a bunch.
--
Allen Guan
281-489-2314
Jul 17 '05 #1
2 1332
.oO(Yun Guan)
I start learning PHP a couple of days ago. I am running PHP 4. on Red Hat 9.
Look like things are setup correct. I have no problem running since script
like
<?
phpinfo();
?>.
You should avoid short open tags (may be disabled on the server and may
cause problems with XML). Use <?php ... ?> instead for portable code.

Escaping from HTML
<http://www.php.net/manual/en/language.basic-syntax.php#language.basic-syntax.phpmode>
However, I can't get the any variable output from the following, whether
clicking on the "Test" or not. $QUERY_STRING, $Year, and $Month are always
empty.


In recent PHP versions register_globals is turned off, that's why these
variables no longer exist.

Chapter 28. Using Register Globals
http://www.php.net/manual/en/security.globals.php

Use the superglobal arrays $_SERVER, $_GET etc. to access their values:

$_SERVER['QUERY_STRING']
$_GET['Year']
....

Predefined variables
http://www.php.net/manual/en/languag...predefined.php

Micha
Jul 17 '05 #2
Thanks. That works. Apparently, the manual I got is too old.

"Michael Fesser" <ne*****@gmx.net> wrote in message
news:i7********************************@4ax.com...
.oO(Yun Guan)
I start learning PHP a couple of days ago. I am running PHP 4. on Red Hat 9.Look like things are setup correct. I have no problem running since scriptlike
<?
phpinfo();
?>.
You should avoid short open tags (may be disabled on the server and may
cause problems with XML). Use <?php ... ?> instead for portable code.

Escaping from HTML

<http://www.php.net/manual/en/languag...ge.basic-synta
x.phpmode>
However, I can't get the any variable output from the following, whether
clicking on the "Test" or not. $QUERY_STRING, $Year, and $Month are alwaysempty.


In recent PHP versions register_globals is turned off, that's why these
variables no longer exist.

Chapter 28. Using Register Globals
http://www.php.net/manual/en/security.globals.php

Use the superglobal arrays $_SERVER, $_GET etc. to access their values:

$_SERVER['QUERY_STRING']
$_GET['Year']
...

Predefined variables
http://www.php.net/manual/en/languag...predefined.php

Micha

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Stevey | last post: by
10 posts views Thread by glenn | last post: by
3 posts views Thread by Ole Weigelt | last post: by
53 posts views Thread by Jeff | last post: by
56 posts views Thread by spibou | last post: by
2 posts views Thread by Allan Ebdrup | last post: by
3 posts views Thread by Zhang Weiwu | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.