Download Excel (phpExcel) by clicking the button

Đã có trọn bộ đề thi thử THPT Quốc Gia 2022 các môn: vip.dethihsg247.com
QUẢNG CÁO: Đổi thẻ cào thành tiền mặt min rút 10k tại đây

I am trying to download an Excel using the phpExcel library only when it receives a $ _POST parameter.

Currently I have a file called my-information.php where I have a table and a button that executes this function:

In my my-file-generator.php file I have this code:

This way the file does not run, it does not download the Excel document. But if I copy the code that is inside the conditional and paste it in the my-information.php file, it executes perfectly when opening the page.

I tried adding the full conditional inside the my-information.php file and fetching the same file but it doesn’t work either and the console gives me this error. Apparently the problem is to do it using the $ _POST parameter:

I need to make the file generate and download only when I click the button, I have tried many ways and I can’t do it, could you please help me.

Xin chào các bạn và quý Thầy Cô. Hãy nhập từ khóa mình muốn vào ô tìm kiếm trên Website để tìm kiếm mọi thứ hoặc trên google các bạn hãy nhập từ khóa + dethihsg247.com để tìm kiếm các bài viết của chúng tôi nhé.
  • Hiện tại chúng tôi có hơn 25 nghìn bài văn mẫu các thể loại.
  • Kho tài liệu, đề thi học sinh giỏi các lớp vô cùng phong phú.
  • Mỗi ngày cập nhật hơn 100 đề thi chất lượng từ các website bán tài liệu lớn.

Tải đề thi VIP với giá siêu rẻ tại Vip.Dethihsg247.Com