Variables empty via included files?

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
ancalagon
Forum Newbie
Posts: 2
Joined: Fri Jul 21, 2006 12:39 am

Variables empty via included files?

Post by ancalagon »

(Sorry if this has been asked before, I found it difficult to narrow my search results)

I've been using php for at least a year and a half now that has been hosted on a linux server.
Recently I tried creating a backup of my webpage on an ubuntu laptop I have at home via DynDns and it appears to accessable like that (at least on my network anyway).

However I was running into some problems where parametres passed via the address-bar were ignored completely.
I decided to look into it and (whether it is related or not) I discovered that my variables were no longer accessable from within included files where they have been (and still are) working on the hosted server.

This is a summary of what what I did to test the output.

Within index.php:
echo "//1: ".$path;
include "menu/menu.php";
echo "//3: ".$path;

Within menu/menu.php:
echo "//2: ".$path;

When I viewed the source #1 & #3 had echoed $path but #2 had not. (#2 is not within a function - so it's not just me forgetting to put "global" in).
Is there a setting by that disables that functionality? Any suggestions or a poke in the right direction would be appreciated.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

what if you do this

Code: Select all

echo "//2: ".$_GET['path'];
ancalagon
Forum Newbie
Posts: 2
Joined: Fri Jul 21, 2006 12:39 am

Post by ancalagon »

It's the same result.
Post Reply