There is an issue with this output. When the user clicks the button, it should spit out an excel sheet. However, for some users, it spits out an HTML page. I have a feeling it has something to do with other users having IE7 instead of IE10. However, this function should work for both.
Please help.
Let me know if you can spot the error:
$time = time();
$illegals = array('!', '*', "'", ";", ":", "@", "&", "=", "+", "$", ",", "/", "?", "%", "#", "[", "]", "\"");
if(isset($_GET['ns_title'])) {$filename = str_replace($illegals,"",urldecode($_GET['ns_title'])).".xls"; } else { $filename = "myreport$time.xls"; }
header("Content-type: application/force-download");
header("Content-Transfer-Encoding: Binary");
header("Content-type: application/octet-stream");
header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Expires: 0");
print "$headers
$data";