Most of the programmers who start learning PHP after other non web centric languages like c/c++/perl/python where that they can just pass around global variables from one module/file to another , think that they can do just that from one php script to another across different invocations of URL.
This in not possible in PHP as it is a state less language (HTTP is a stateless protocol) and every request is a new request. The two possible alternative ways in which you can do this is
1) Maintain a session variable. Session variables can be persisted between different invocations
2) Have the variables being shared in DB such that the different PHP pages can access them.
Another possible option is cookies and in HTML5 you also have an option of local storage but these are client side storage options and if the browsers disable them then you have no workarounds.