Using the id how to export the table in to excel and pdf
<?php
echo "<table id="report">";
echo "<tr>";
echo "<td>";
echo "test";
echo "</td>";
echo "</tr>";
echo "</table>";
<button id="export">Export</button>
?>
Using the id how to export the table in to excel and pdf
<?php
echo "<table id="report">";
echo "<tr>";
echo "<td>";
echo "test";
echo "</td>";
echo "</tr>";
echo "</table>";
<button id="export">Export</button>
?>
you have a couple of options on each, some of which are these. There is though, no 'magic' wand method.
excel
use the most excellent PHPSpreadsheet (formerly PHPExcel)
for pdf
wkhtmltopdf
Use wkhtmltopdf. This requires that you have server root access but allows you to dump in HTML and get a PDF out that looks the same as the webpage would have done.
Wkhtmltopdf will also process CSS and parse js. So its very useful for making pdf's from dynamic output.