title: To obtain the previous page's URL in php
body: <p>i have got 5 php pages which are question papers (MCQ's).</p>
  
  <p>the user is provided with 1 of the papers...which he answers and submits...it then goes to <strong>AnsCheck.php</strong> ...in AnsCheck.php i need to understand from which page i.e from which of the 5 papers the request was received so that i can proceed with the checking ...how do i obtain the page from where i received the request?</p>
  
  <p>----1.php----</p>
  
  <pre><code>&lt;?php
  (E_ALL &amp; ~E_NOTICE);
  
  session_start();
  
  // is the one accessing this page logged in or not?
  if (!isset($_SESSION['db_is_logged_in'])
     || $_SESSION['db_is_logged_in'] !== true) {
  
     // not logged in, move to login page
     header('Location: login.php');
     exit;
  }
  
  ?&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;My Page&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form name="1" action="/NewDir/AnsCheck.php" method="POST"&gt;
  1.Name the owl of harry potter.
  &lt;div align="left"&gt;&lt;br&gt;
  &lt;input type="radio" name="paper1" value="op1"&gt;Mr Barnesr&lt;br&gt;
  &lt;input type="radio" name="paper1" value="op2" checked&gt; Wighed&lt;br&gt;
  &lt;input type="radio" name="paper1" value="op3"&gt; Hedwig&lt;br&gt;
  &lt;input type="radio" name="paper1" value="op4"&gt; Muggles&lt;br&gt;
  &lt;input type="submit" name="submit" value="Go"&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>