Page 1 of 1

get method doesn't work....

Posted: Fri Sep 12, 2003 9:18 am
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

Posted: Fri Sep 12, 2003 9:29 am
by brewmiser
Make sure and read the stickies first.....this should help.

viewtopic.php?t=511

PHP by default sets register_globals to off.

Posted: Fri Sep 12, 2003 9:31 am
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

Posted: Fri Sep 12, 2003 11:12 am
by m3rajk
are you sure that will work? i always set the variable first.

Posted: Fri Sep 12, 2003 12:06 pm
by JayBird
Yes, it sure will work, try it and find out.