title: PHP - Sending GET variables as a Path in and Include/Require Statement
body: <p>I have a situation where I would like to use a php file "query.php" to look take either a <code>$_POST</code> or <code>$_GET</code> value as the MySQL query. It looks like this:</p>
  
  <pre><code>&lt;?php
  //verify data has been sent via POST or GET and set strings
  //find supplied table name
  if(isset($_POST['tblName'])){
      $strSuppliedTableName = $_POST['tblName'];
  }
  if(isset($_GET['tblName'])){
      $strSuppliedTableName = $_GET['tblName'];
  }
  else{
      $strSuppliedTableName = 'roles';
  }
  
  //find supplied field name or default to all fields in the table
  if(isset($_POST['fieldName'])){
      $strSuppliedFieldName = $_POST['fieldName'];
  }
  else if(isset($_GET['fieldName'])){
      $strSuppliedFieldName = $_GET['fieldName'];
  }
  else{
      $strSuppliedFieldName = '*';
  }
  
  //query db
  $query = 'SELECT ' . $strSuppliedFieldName . ' FROM ' . $strSuppliedTableName;
  
  $results = mysql_query($query) or die(mysql_error());
  ?&gt;
  </code></pre>
  
  <p>Following that, I want to include this file "query.php" in another file that will manage the results. I'm trying to make this as modular as possible.</p>
  
  <pre><code>&lt;?php
  require_once("query.php?tblName=classes");
  ......... (while loop, yadi yadi
  </code></pre>
  
  <p>However, I recieve an error:</p>
  
  <blockquote>
    <p>Warning: require_once(query.php?tblName=classes) [function.require-once]: failed to open stream: No such file or directory </p>
  </blockquote>
  
  <p>Is it not acceptable to pass GET values to your included file? PHP won't process this?</p>