get method doesn't work....

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
yaron
Forum Contributor
Posts: 157
Joined: Fri Aug 22, 2003 8:40 am

get method doesn't work....

Post by yaron »

Hi,
I have just installed php 4.3.3 with apache 1.3.7
everthing seem to work ok but one strange thing.
the get or post method.
file t1.php:
<?
$var="hello";
echo "<a href='t2.php?var=$var'>to t2</a>";
?>
file t2.php:
<?
echo "var=$var";
?>
the result is: var=
variable is empty though I see in the url : t1.php?var=hello
howcome???
maybe it's something to do with my installation?
thanks
User avatar
brewmiser
Forum Commoner
Posts: 74
Joined: Mon Aug 18, 2003 12:50 pm
Location: Dallas, TEXAS

Post by brewmiser »

Make sure and read the stickies first.....this should help.

viewtopic.php?t=511

PHP by default sets register_globals to off.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Yup, read that thread.

REGISTER_GLOBALS is off by default.

Code: Select all

<? 
echo "var=".$_GET['var']; 
?>
and it will now work

Mark
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

are you sure that will work? i always set the variable first.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Yes, it sure will work, try it and find out.
Post Reply