Making a variable global does not make it accessible from other scripts, it simply makes it accessible from within a function (in the same script).
To pass data between scripts, you need to either save it in a file or a database, set a cookie, use sessions, or pass the data from one script to another in the url or using a hidden input in a form.
Saving data in a file/database is what you should do if you want the variables to remain set for the script no matter who is viewing the page - for example, a hit counter.
Setting a cookie or using sessions sets variables that can be accessed by any script on your site, but they work by storing information on the browser, so they are restricted to scripts called by the same user. An example of this is current login information for a user on a site.
You can get a similar effect as cookies or sessions by passing data in the url. The advantage of this method is that it doesn't require cookie support on the browser, which is often disabled for secirity reasons.