Page 1 of 1

Please help!!

Posted: Fri Sep 22, 2006 4:04 pm
by BachgenCymreig
Hi, I was wondering if someone could be so kind to help with a problem I am having.

I am using the following code:

Code: Select all

<?php
  if (!isset($id)) {
   header("Location: index.php?id=home");
}
?>
Ok the problem I am getting is I have one server running PHP 4.4.1 and this code works fine so if you try to load index.php it redirects to index.php?id=home because id hasn't been defined in the URL. Now the problem is when I try to use this on the server (which I really need it to work on) which is running PHP 4.4.2 it gets stuck in some sort of loop and won't load.

Is this a problem with the PHP version, is there an alternative way to do this? or what????

Help!!!

Any suggestions appreciated.

Thanks!

Posted: Fri Sep 22, 2006 4:10 pm
by s.dot

Code: Select all

if(!isset($_GET['id']))
Your current code relies on register_globals being on. It is probably off (as it should be) on the current server.

Posted: Fri Sep 22, 2006 4:17 pm
by BachgenCymreig
Let me try that - ty :D

Posted: Fri Sep 22, 2006 4:19 pm
by gkwhitworth
Just thought I'd let you know that you will get more help if your subject is more specific than "Please help." You could of used "Problems redirecting on PHP 4.2" or something. I thought I'd tell you before one of the mods laid a smack down. :lol:

--
Greg