<?php
header("Content-Type: application/vnd.ms-excel");
$report_name = "report.xls";
if(isset($rpt_name)){
    $report_name = $rpt_name."@".date("d_m_Y");
}
header('Content-Disposition: attachment; filename="'.$report_name.'".xls"');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
    </head>
    <body>
        <?php
        if(isset($tbl)) echo $tbl;
        ?>
    </body>
</html>