简体   繁体   中英

export file from table to excel using php

hi im a newbie in programming and im using php. below is my code for .xls. i have one form where i have three buttons the add search and "save to excel". and also i have a table where my output for add button will be shown and that was connected to my database. now my problem is when i click the button "save to excel", the whole data in my form appear to the excel. what i want is that the table in my form will be only save in my excel. not the whole data in my form. if i can only post the image here you probably might understand me clearly. :( . but please i need some help. :( .. thanks

if (isset($_POST['download']))
{
$file="document_name" . date('Ymd') . ".xls";

header("Content-type: application/vnd.ms-excel");// file extension name
header("Content-Disposition: attachment; filename=$file");

}
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");;
header("Content-Disposition: attachment;filename=line_utilization_report.xls ");
header("Content-Transfer-Encoding: binary ");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM