title: PHP: Header redirects me to previous instance of location page
body: <p>I have a page that displays editing options if a certain POST variable is set, like so:</p>
  
  <pre><code>if(isset($_POST['manageType']) &amp;&amp; ($_POST['manageType'] == 'edit'))
  {   
      display_edit_gallery($title, $_GET['gallery']);
  }
  </code></pre>
  
  <p>In display_edit, there's something like this:</p>
  
  <pre><code>&lt;form action="manage/manage_gallery.php" method="post"&gt;
      &lt;input type="hidden" name="page" value="gallery_page.php" /&gt;
      &lt;input type="submit" name ="submit" value="Edit" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I then do some stuff on manage_gallery.php and I finish with</p>
  
  <pre><code>header("Location: " . $_POST['page']);
  exit();
  </code></pre>
  
  <p>The edit is performed, I am redirected, except it seems I'm redirected to the instance of gallery_page.php I just left. $_POST['manageType'] is still set (and so the editing options are still being displayed) despite the fact that nothing has been sent through post in manage_gallery.php. I do something similar with a 'delete image' option and the same happens. The image is deleted, but I need to reload the page for it not to be displayed anymore. It's like header() performs a 'back to the previous page' sort of thing.</p>
  
  <p>I've used HTTP_REFERER instead and it works perfectly but I've been told it's not the safest option so I'd rahter avoid it . .</p>