Escape special characters in header
<p>In a webpage a user can enter strings into input elements. After the form is submitted, all inputs are verified against rules. After the validation the inpit page is displayed again to the user with marked errors and the already filled in input elements.</p>

<p>Partial code in the validation page for sending back the data:</p>

<pre><code>$query_string = '?filename='.$timed_file_name . '&amp;name=' . $name . '&amp;text='.$text; 
header('Location: http://' . $server_dir . $next_page . $query_string);
</code></pre>

<p>It's obvious that the ampersand cannot be used in the header, because if I type jack&amp;jones it will mess up the header and php will return only jack.</p>

<p>I can do it in an ugly way:</p>

<p>Validation page:</p>

<pre><code>$name = html_entity_decode($name); 
$name = str_replace("&amp;","aammppeerrssaanndd",$name);
</code></pre>

<p>Input page:</p>

<pre><code>$name = $_GET['name'];
if (strpos($name,'aappoossttrroopphh') !== false) {
    $name = html_entity_decode($name); 
    $name = str_replace("aappoossttrroopphh","&amp;",$name);
}
</code></pre>

<p>Is there an easy solution for this?</p>
