Originally posted by donnierivera
When calling $DOCUMENT_ROOT in a function. You must make it global. hmm... Don't quit understand since it is a system variable, but I guess it makes since because I called it in a function.
$DOCUMENT_ROOT is indeed set by the system to be the document root of your website, but is only available in the global scope, i.e. outside of functions.
To use any of these variables you MUST declare them as global before using them (the same goes for $PHP_SELF, $HTTP_POST_VARS etc etc).
The only variables which you can use without having to do this first are what PHP calls Superglobals. Go take a read on pre-defined variables on the PHP manual at http://www.php.net/manual/sv/language.variables.predefined.php