title: problem with downloading csv file through HTTP header
body: <p>so attempted this:</p>
  
  <pre><code>header("Content-type: application/csv");
  header("Content-Disposition: attachment; filename=file.csv");
  header("Pragma: no-cache");
  header("Expires: 0");
  echo $fields;
  </code></pre>
  
  <p>tried also and many others.</p>
  
  <pre><code>header("Content-type: text/csv");
  </code></pre>
  
  <p>what happens however is, the MySQL data simply echos out to the browser.</p>
  
  <p>this is the HTTPheaderResponse i grabbed with firebug:</p>
  
  <pre><code>Date    Wed, 18 May 2011 14:15:18 GMT
  X-Powered-By    PHP/5.1.6
  Content-disposition attachment;filename=MyVerySpecial.csv
  Connection  close
  Content-Length  992
  Server  Apache/2.2.3 (Red Hat)
  </code></pre>
  
  <p><strong>EDIT:</strong> note it is a return from a JQuery .post() I am trying this, if that affects it.</p>
  
  <p>so, does anyone know why this issue may be occuring? I am at a loss.</p>
  
  <p>thanks</p>