spstieng, regarding the source code: occasionally a host for some reason or other will have a borked server that will fail to parse php, and will show users the source code. You should look for a reliable server who never lets this happen. If this is what you mean with users seeing the source code, what you can do is make sure you have a reliable host, and put your really sensitive info, like db name, dbusername, dbpassword in an include file outside the webdirectory.
You can pass variables from function to function, and to include files, without worrying too much that the user will see them, as long as your scripts are rather secure. You do this simply by setting and manipulating the variables ($a=2; $a=$a+9😉 and including other files, or using them in functions where these variables are used as the parameters of the function, or are declared as global within the function. You should look at the php manual or a php book and check out the chapters on "scope" and "globals," and also "external variables." External variables are those that come into php via e.g. parameters passed through the url (which are the "GET" method), the POST method, through cookies ... check out the sources. You DO have to be sure that all unexpected input from these sources don't do weird stuff or allow somebody to hack your site.
To pass information between pages, you should never use GET for sensitive information, for the reasons sijis mentions. Might sound weird, but I regularly get referrers on my site from people using scripts that are so bad and insecure they leave both username and password in the url with GET. Using "sessions" would probably be the most common way, with the most documentation available.