Title:  Why are my PHP variables empty?

Question:
I am trying to access the values of PHP form, environment, and/or server
variables with the following PHP code: 

  echo ("$varname");      // form variable
  echo ("$REMOTE_HOST");  // environment variable
  echo ("$PHP_SELF");     // server variable 

When I go to the page, the value of my variable doesn't print. What's going on?

Answer:
Before PHP version 4.2.0, this syntax was valid by default.  Any form
variable passed to a PHP script had global scope and could simply be
referenced by name.

This created a security risk, however, so all versions of PHP since 4.2.0
are centrally configured with this syntax disabled.

The correct syntax for securely accessing form, environment, and server
variables involves PHP's "superglobal" arrays.  The following examples
demonstrate correct usage:

1.  To access form variables, use 

         $_POST['varname']    or    $_GET['varname']

    depending on whether you're using the POST or GET form method.

2.  To access environment variables, use

 	$_ENV['REMOTE_HOST']

    substituting the environment variable you want for REMOTE_HOST.

3.  To access server variables, use

	$_SERVER['PHP_SELF']
    
    substituting the server variable you want for PHP_SELF.

Superglobals are discussed in more detail on the PHP Predefined Variables
page:

    http://www.php.net/manual/en/language.variables.predefined.php

If you have old PHP scripts that cannot be updated practically to the new
format, you can create a local PHP configuration file that allows you to
use the deprecated syntax.  For instructions on doing this, see:

    http://www.washington.edu/computing/web/publishing/php-ini.html