View Full Version : Php header content

06-01-2011, 10:37 AM
I am wondering when I paste this code below above the many codes, it does not open a prompt to save an excel file? But when I paste it somewhere in the middle it opens up.

$fileName = 'mysql-to-excel.xls';
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$fileName");