Exporting Data to Microsoft Excel - PHP Views : 369
Tagged in : PHP
0 0
Send mail
You can export content from a php page to an excel spreadsheet as follows,

<form action = "excel.php" method = "post">
<input type = "hidden" name = "body" value = "">
<input type = "submit" name = "submit" Value = "Export to excel">
</form>


In excel.php file,

$fn=$_POST['body'];
header("Content-type: application/csv");
header("Content-Disposition: attachment; filename=excel.xls");
header("Pragma: no-cache");
header("Expires: 0");
print "$fn";
?>
By Rekha, On - 2009-11-13



    Login to add Comments .