title: PHP - Notice: Undefined variable: _REQUESTS
body: <p>Hi i'm creating a site with a  search box this is already done in asp and im redoing it in php (which I am new too) and it will take you to another page where it searches the db using sql.
  The search-process.php file is below</p>
  
  <pre><code>&lt;?php
  $db = realpath("db\unibookv2.mdb");
  $conn = new COM('ADODB.Connection') or exit('Cannot start ADO.');
  $connStr = "PROVIDER=Microsoft.Jet.OLEDB.4.0;
  Data Source=$db";
  $conn-&gt;Open($connStr);
  
  
  
  $sql = "SELECT * FROM ubuser WHERE usr_firstname LIKE '%" . $_REQUESTS['searchinput'] .  "%' OR usr_lastname LIKE '%" . $_REQUESTS['searchinput'] . "%' ORDER BY '%" . $_REQUESTS['orderlist'] . "%' ";
  
  $userRs = $conn-&gt;Execute($sql);
  if (!$userRs)
      {exit("DBMS Error..!");}
  ?&gt;
  
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
  &lt;head&gt;
  &lt;title&gt;PHP Search Results - ADO-COM connection!&lt;/title&gt;
  &lt;meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" /&gt;
  &lt;link rel="stylesheet" type="text/css" href="css/unibookStyle.css" /&gt;
  &lt;/head&gt;
  &lt;!-- #include FILE="include/header.asp") --&gt;
  
  
  &lt;body&gt;
  &lt;div id="container"&gt;&lt;!-- start container --&gt;
  
  &lt;h2&gt;USER DATABASE&lt;/h2&gt;
  
  &lt;!-- start of dynamic html page --&gt;
  &lt;h2&gt;PHP/ADO-COM (MS Access) basic parameterised example&lt;/h2&gt;
  &lt;h3&gt;You searched for : '&lt;?php echo $_REQUEST['searchinput']; ?&gt;' - 
  
  &lt;hr align="left" width="658" /&gt;
  
  &lt;?php
  // example of testing for EOF in resultset  
  if (!$userRs-&gt;EOF)
  {
  echo "one or more records found&lt;br /&gt;";
  }
  else
  {
  echo "sorry, no records found&lt;br /&gt;";
  }
  ?&gt;
  
  &lt;!-- start of html table --&gt;
      &lt;table border="0" width="758" cellspacing="0" cellpadding="3"&gt;
  
      &lt;!-- create the first (heading) row in standard HTML --&gt;
      &lt;tr class="tableheading"&gt;
          &lt;td&gt;&lt;b&gt;Usr_id&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;firstname&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&amp;nbsp;&lt;b&gt;lastname&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;
  
      &lt;/tr&gt;
  &lt;!-- loop in PHP to retrieve all records --&gt;
  &lt;?php
      $nrecs=0;
      while (!$userRs-&gt;EOF) { 
      $nrecs++;   
      ?&gt;
      &lt;tr&gt;
      &lt;!-- use in-line PHP to display the data --&gt;
          &lt;td&gt;&lt;?php echo $userRs-&gt;Fields['usr_id']-&gt;Value ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $userRs-&gt;Fields['usr_firstname']-&gt;Value ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $userRs-&gt;Fields['usr_lastname']-&gt;Value ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;!-- important line as it moves the resultset 'cursor' --&gt;
      &lt;?php $userRs-&gt;MoveNext() ?&gt;
  &lt;?php } ?&gt;
  &lt;/table&gt;
  
  
  &lt;?php
  // close and destroy object instances
  $userRs-&gt;Close();
  $conn-&gt;Close();
  
  $userRs = null;
  $conn = null;
  
  // display records found to page
  echo "&lt;br /&gt;Number of records found: " . $nrecs;
  ?&gt;
  
  &lt;p&gt;&amp;nbsp;&lt;/p&gt;
  &lt;hr align="left" width="658"&gt;
  
  &lt;input type="button" value="&lt; Back to Search Page" OnClick="top.location='default.asp'"&gt;
  
  &lt;!-- #include FILE="include/sidebar.asp") --&gt;
  
  &lt;!-- #include FILE="include/footer.asp") --&gt;
  &lt;/div&gt;
  &lt;!-- end main page content --&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is the error I am getting about the variables being undefined, im assuming this is the "[searchinput]" twice and once for the "[orderlist]"</p>
  
  <pre><code>Notice: Undefined variable: _REQUESTS in H:\STUDENT\S0190204\part1\search-process.php on line 10 Notice: Undefined variable: _REQUESTS in H:\STUDENT\S0190204\part1\search-process.php on line 10 Notice: Undefined variable: _REQUESTS in H:\STUDENT\S0190204\part1\search-process.php on line 10
  </code></pre>
  
  <p>Other problems are the search term used does not work and the order by also, but i have a feeling these problems are going to be solved by the same thing</p>