title: PHP: $_POST, $_GET and $_REQUEST empty on input form evaluation
body: <p>a question that is being asked many times as far as I can see.
  Lots of postings concerning this issue also on this website, for example</p>
  
  <p>here: <a href="https://stackoverflow.com/questions/17661677/post-empty-on-form-submit">$_POST empty on form submit</a>
  and here:
  <a href="https://stackoverflow.com/questions/15776911/post-get-and-request-empty">$_POST, $_GET and $_REQUEST Empty</a></p>
  
  <p>But none of them cured my problem.</p>
  
  <p>I´ve a simple HTML input form with a submit button.
  Its "name" tag is set.</p>
  
  <p>My php.ini settings are:</p>
  
  <pre><code>request_order = "GP"
  variables_order = "GPCS"
  register_globals = Off
  </code></pre>
  
  <p>The input data is being processed in the Method "action" in "Util.php".
  The code for the input form as well as the Util::action method has been provided by our professor (its an assignment for university), as we developed a similar project during the php seminar.</p>
  
  <p>Unfortunately, the $_REQUEST array stays empty in my project.</p>
  
  <p>here´s the source code of the input form:</p>
  
  <pre><code>&lt;?php
  require_once('inc/bootstrap.php');
  
  
  if (AuthenticationManager::isAuthenticated()) {
      Util::redirect("index.php");
  }
  
  $userName = isset($_REQUEST['userName']) ? $_REQUEST['userName'] : null;
  ?&gt;
  
  &lt;?php
  require_once('inc/header.php');
  ?&gt;
  
  &lt;h2&gt;Login&lt;/h2&gt;
  
  &lt;form method="post" action="&lt;?php echo Util::action('login'); ?&gt;"&gt;
      &lt;table&gt;
          &lt;tr&gt;
              &lt;th&gt;User name:&lt;/th&gt;
              &lt;td&gt;&lt;input name="userName"
                  value="&lt;?php echo htmlentities($userName); ?&gt;" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;th&gt;Password:&lt;/th&gt;
              &lt;td&gt;&lt;input type="password" name="password" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
      &lt;input type="submit" value="Login" name='login' /&gt;
  &lt;/form&gt;
  
  &lt;?php
  require_once('inc/footer.php');
  ?&gt;
  </code></pre>
  
  <p>and here the Util.php:</p>
  
  <pre><code>    &lt;?php
  
      class Util extends BaseObject {
      // Bereinigen eines Strings für die HTML-Ausgabe
      /**
       * @param string $string
       * @return string
       */
      public static function escape($string) {
          return nl2br(htmlentities($string));
  
      }
  
  
  
      /**
       * @param string $action
       * @param array $params
       */
      public static function action($action, array $params = null ) {
  
          //enters ELSE branch as IF branch evaluates to false
          //(because $_REQUEST contains 0 elements
          //(so do $_GET and $_POST)
          $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : $_SERVER['REQUEST_URI'];
  
          //just an attempt for hardcore debugging...
          $req = array_merge($_GET, $_POST); 
          $page = count($req); //evaluates to zero
  
          $res = '/lib/controller.php?action='.rawurlencode($action).'&amp;page='.rawurlencode($page);
          //result is: localhost/lib/controller.php?action=login&amp;page=0
  
          if ( is_array($params) ) {
              foreach ( $params as $name =&gt; $value ) {
                  $res.='&amp;'.rawurlencode($name).'='.rawurlencode($value);
              }
          }
  
          return $res;
      }
  
      public static function redirect($page = null) {
          if ( $page == null ) {
              $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : $_SERVER['REQUEST_URI'];
          }
  
          header('Location: '.$page);
      }
  
      /**
       * Converts a tinyint (from MySQL DB) to boolean (PHP)
       * @param int $tinyInt
       * @return boolean
       */
      public static function tinyintToBoolean($tinyInt) {
          if ($tinyInt == 1) {
              return true;
          } else {
              return false;
          }
      }
  }
  
  ?&gt;
  </code></pre>
  
  <p>bootstrap.php:</p>
  
  <pre><code>&lt;?php
  error_reporting(E_ALL); ini_set('display_errors', 'On');
  
  /**
   * bootstrap must be included in every callable view 
   * 
   */
  spl_autoload_register(function ($class) {
      include 'lib/' . $class . '.php';
  
  });
  
  // create session
  SessionContext::create();
  
  //require_once('lib/data/DataManager_' . $class . '.php');
  require_once('lib/DataManager.php');
  
  ?&gt;
  </code></pre>