Page 1 of 1

using IIS, variables won't pass from link

Posted: Fri Apr 28, 2006 9:05 pm
by tbbd
i have very simple script that just passes variable from one page to another in the link

contents of page1.php

Code: Select all

<?php
$value = 1;
echo "<a href=\"page2.php?value=$value\">Link</a>";
?>
contents of page2.php

Code: Select all

<?php
echo "value is: " .$value;
?>
I upload to a webhost that I have a site on and it works great
I keep it on my pc (wxp with IIS and php4) and run from localhost, the value does not get passed over. Nothing is displayed as $value.
After reading other forums where people had similar issues (although theirs was always from a form), I set register_globals=On in my php.ini, that didn't help either. It has to be something with the configuration of either php or IIS

Posted: Fri Apr 28, 2006 9:16 pm
by Burrito
you have register globals OFF on your local host...which is a good thing ( you should tell your provider to turn it off too ;) )

try echoing

Code: Select all

echo "value is: ".$_GET['value'];

Posted: Fri Apr 28, 2006 9:40 pm
by tbbd
like I said in the first post, I did turn register globals On, but ti didn't help, so now I have turned it Off, then did the $_GET as you suggested and it works great...
now, I have this on my localhost to design the pages first, then I upload them to the webserver when all is ready, will it hurt to leave all the $_GET and $_POST info in there to put on the host or will I need to change it when I do that?

Posted: Fri Apr 28, 2006 9:44 pm
by Burrito
nope...leave them as separate arrays...it will work on your dev (local server) and host just fine.

really your host should turn them off.

Posted: Fri Apr 28, 2006 10:00 pm
by tbbd
thanks for all your help...I'll send an email to them and suggest that to them