PHP - header redirect with # breaks in MSIE
<p>When redirecting with header() after a form upload, if there is # in the redirect, it disappears in MSIE, but works properly in other browsers. I've made the following simple script as an example:</p>

<pre><code>&lt;?php
if (isset($_REQUEST["description"])) {
    $location = "http://localhost/#someanchor";
    header("Location: $location");
    exit;
}
?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
    &lt;head&gt;
        &lt;title&gt;PHP header redirect with #&lt;/title&gt;
        &lt;meta http-equiv="Pragma" content="no-cache" /&gt;
        &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;div&gt;
            &lt;form enctype="multipart/form-data" method="post" action="&lt;?php echo $_SERVER["PHP_SELF"]?&gt;"&gt;
                &lt;div&gt;
                    Description &lt;input type="text" name="description" /&gt;&lt;br /&gt;&lt;br /&gt;
                    File &lt;input type="file" name="uploadfile" /&gt;&lt;br /&gt;&lt;br /&gt;
                    &lt;input type="submit" /&gt;
                &lt;/div&gt;
            &lt;/form&gt;
        &lt;/div&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>In Firefox and other browsers it redirects to <a href="http://localhost/#someanchor" rel="nofollow">http://localhost/#someanchor</a></p>

<p>In MSIE it redirects to <a href="http://localhost" rel="nofollow">http://localhost</a> (loses the anchor)</p>

<p>If I remove the file input, then it works in MSIE as well! (but I need the file upload)</p>

<p>I could work around it with Javascript but maybe there is something I'm missing here?</p>
