I am writing a PHP script which is running a for
loop. I am creating multiple tables inside the loop and i want to dynamically name the tables based on the loop.
I have already tried the following code but it doesn't work:
<table id="gameweek_history<? echo $i; ?>">
<script>function doCSV<? echo $i; ?>() {
var table1 = document.getElementById("gameweek_history<? echo $i; ?>").innerHTML;
<button onclick="doCSV(<? echo $i; ?>)">Export HTML Table To CSV File</button>
Could you please explain to me what i need to change ?