title: php/html - http_referer
body: <p>I am creating a website and on one particular page, am wanting to send the user back to the previous page. I am fairly new to PHP/HTML and have been using some existing code for ideas and help.</p>
  
  <p>The existing code uses the following method:</p>
  
  <pre><code>if (! empty($HTTP_REFERER)) 
  {
      header("Location: $HTTP_REFERER");
  } else 
  {
      header("Location: $CFG-&gt;wwwroot");
  }
  </code></pre>
  
  <p>However, when I use this code the HTTP_referer is always treated as empty and the user redirected to the root page. Any obvious flaws in this code?</p>