Once upon day, A talks to B. "palz, how to export data table to excel format using PHP ??? " asked A. "it's easy palz, you can using a library for php to export in excel format. You can download it from the internet" B answered."that's to complex, meanwhile i haven't much money" A deceitful. "Alright, let me show you the way" response B while opened his laptop.
Firstly we make a table like this :
No. |
Name |
Position |
|---|
1 |
A |
Analyst |
2 |
B |
Programmer |
Next we add a code in the top of header like this:
- header("Content-type: application/vnd.ms-excel");
- header("Content-disposition: attachment; filename=coba1.xls");
- header("Pragma: no-cache");
- header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
- header("Expires: 0");
"Finish, that's all. You only put that header" explain B. "OK, i will try it, thanx palz" A answered.