Download file created by PHP without changing windows
<p>I'm generating a file whenever a php script is run, which is downloaded in at the same time by the user (no copies are saved to the server).</p>

<p>Currently I'm redirecting a user from the file creation php script back to the original page.</p>

<p>I'd like to not redirect the user back to the original page but have them stay on the original page and the PHP script to still run and prompting them to save the custom created file.</p>

<p>I'm not entirely sure, but would be adding/changing something from the end of my current PHP script or simply changing my HTML link to it somehow?  I'm</p>

<p>My HTML</p>

<pre><code>&lt;a href="fileCreator.php"&gt;Download File&lt;/a&gt;
</code></pre>

<p>My PHP</p>

<pre><code>header("Content-type: text/txt");
header("Content-Disposition: attachment; filename=file.txt");
header("Pragma: no-cache");
header("Expires: 0");
header("Location: [ORIGINAL PAGE]");
echo $txtFile; 
</code></pre>
