The problem is that your php.ini has register_globals = Off
change it to On.

You can also do the following at the top of your script - (this is the correct way):
<?php
$TestVar = (!empty($_GET['TestVar'])) ? true : false;
?>



Greg Watson wrote:
Hi Guys,

I've Googled and RTFM'd, but I can't seem to figure this out - it may
not even be a php problem but I'm not sure.

I've set up Apache, PHP and MySQL on my laptop running XP Home. Although
I've coded php for a while now, I had never set these up on my own
computer before. The php seems to be parsed ok, but it doesn't look as
though variables are being passed from page to page.

I used this as a VERY simple test:
-------------------------------------

<p>
<a href="index.php?TestVar=1">Variable Test</a>
<?
if (!$TestVar) print "<font color='red'>- Not Set</font>";
if ($TestVar == 1) print "<font color='green'>- Set and Displayed</font>";
?>
</p>


-------------------------------------
When I use this code on my ISP webserver (which I think is running
RedHat Linux, and I know it obviously has php andMySQL), I get the 'Set
and Displayed' message after clicking on the link.

When I use it locally, although the url displays:
http://localhost/index.php?TestVar=1
I still get the 'Not Set' message.

I'm assuming I've not configured something correctly, but I don't know
where else to look! If anyone could help I'd be very grateful. At least if I know it's not the php and to look more at Apache or something!


Thank you,

Greg Watson

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to