<form id="newForm" method="post">
<input type="submit" name="ex" value="Excel" onclick="document.getElementById("newForm").submit()">
</form>
if(isset($_POST["ex"]))
{
header('Content-Type: text/x-csv; charset=utf-8');
header("Content-Disposition: attachment;filename=".date("d-m-Y")."-export.xls");
header("Content-Transfer-Encoding: binary ");
}