Results 1 to 5 of 5
I just installed PHP 5.0.18 on a SuSE Linux server. Everything else seems to work allright, but the variables which are sent with URL are ignored.
On a page with ...
- 04-15-2008 #1Just Joined!
- Join Date
- Jan 2008
- Posts
- 14
URL variables do not come across with PHP
I just installed PHP 5.0.18 on a SuSE Linux server. Everything else seems to work allright, but the variables which are sent with URL are ignored.
On a page with URL
mypage.php?variable=3
This code should print ´3´ , but it does not.
echo "$variable";
Did I overlook something when I installed PHP?
- 04-15-2008 #2
PHP does not automatically create the variables for you to use. Instead, they are passed in a special array depending on how they were passed: $_POST for POST variables, and $_GET for GET variables. If you don't care, then you can use $_REQUEST.
So we can one of the following:
Hope that helps.Code:echo $_GET['variable']; echo $_REQUEST['variable'];
DISTRO=Arch
Registered Linux User #388732
- 04-15-2008 #3Just Joined!
- Join Date
- Jan 2008
- Posts
- 14
$_GET[] and $_REQUEST[] do work, but why does this code give different resul on my recently installed server than on my old server
Code:<?php echo "<a href=mypage.php?var=2>click</a>"; echo "<br>first "; echo $var; echo "<br>second "; echo $_REQUEST['var']; ?>
On my new server clicking on the link produces page like this
whereas the old server gives a page like thisclick
first
second 2
Otherwise I would not mind, but there will be one helluva lot of work in adding "$_REQUEST" to my formerly written codes.click
first 2
second 2
- 04-16-2008 #4
This is a change made in PHP 4.2.0. It is well explained at:
PHP: Using Register Globals - ManualDISTRO=Arch
Registered Linux User #388732
- 04-16-2008 #5Just Joined!
- Join Date
- Jan 2008
- Posts
- 14
I get it. Thanks


Reply With Quote