title: Change Response URL without Redirect
body: <p>Is it possible to change the response URL without performing a redirect?</p>
  
  <p>The slightly longer story...</p>
  
  <p>Due to a limitation with HTML forms the following does not work because the query string from the action URL is not submitted to the server:</p>
  
  <pre><code>&lt;?php // handler.php ?&gt;
  ...
  &lt;form action="handler.php?lost=value" method="get"&gt;
      &lt;input type="text" name="filter-keyword" value="" /&gt;
      &lt;input type="submit" name="do-submit" value="Submit" /&gt;
  &lt;/form&gt;
  ...
  </code></pre>
  
  <p>So I decided to switch to using the post method and create a separate filter handler script which simply constructs the correct query string for the "handler.php" file.</p>
  
  <pre><code>&lt;?php // handler.php ?&gt;
  ...
  &lt;form action="filter-handler.php" method="post"&gt;
      &lt;input type="hidden" name="preserve-qs" value="lost=value" /&gt;
      &lt;input type="text" name="filter-keyword" value="" /&gt;
      &lt;input type="submit" name="do-submit" value="Submit" /&gt;
  &lt;/form&gt;
  ...
  
  // filter-handler.php
  &lt;?php
      $new_url = 'handler.php?filter-keyword=' . $_POST['filter-keyword'];
      if (isset($_POST['preserve-qs']) &amp;&amp; $_POST['preserve-qs'] != '')
          $new_url .= '&amp;' . $_POST['preserve-qs'];
  
      header("Location: $new_url");
  ?&gt;
  </code></pre>
  
  <p>Is it possible to achieve this without performing a redirect?</p>
  
  <pre><code>// filter-handler.php
  &lt;?php
      $qs_args = array(
          'filter-keyword' =&gt; $_POST['filter-keyword'];
      );
      if (isset($_POST['preserve-qs']) &amp;&amp; $_POST['preserve-qs'] != '')
          parse_str($_POST['preserve-qs'], $qs_args);
  
      // Fake query string.
      $_GET = $qs_args;
  
      // handler script is blissfully unaware of the above hack.
      include('handler.php');
  
  
      // ???? HOW TO UPDATE QUERY STRING IN BROWSER ADDRESS BAR ????
  
      // Following no good because it redirects...
      //header("Location: $new_url");
  
  ?&gt;
  </code></pre>