I have a little problem, what I need is to read data from this HTML table, problem is I do not know how much table rows I’ll have because I put data in it from MySQL select, so what I really want is after select, to add some data in the HTML table to be specific:
<td><input type="text" size="5px"></td>
and on button click to read data from all new table rows inputs.
<table style="display:inline">
<tr>
<td></td>
<th>Home team</th>
<td></td>
<td></td>
<td></td>
<th>Away team</th>
</tr>
<?php
$i=0;
while ($i < $num) {
$Tim1=mysql_result($result,$i,"HomeTeamID");
$Tim1Name=mysql_result($result,$i,"HomeTeam");
$Tim2=mysql_result($result,$i,"AwayTeamID");
$Tim2Name=mysql_result($result,$i,"AwayTeam");
$rez=mysql_result($result,$i,"MatchID");
?>
<tr>
<td class="ID" id="<?php echo $rez;?>"><input value="<?php echo $rez;?>"
name="<?php echo $rez;?>" type="hidden" style="display: none">
</td>
<td><label style="padding-right:10px" ><?php echo($Tim1Name); ?></label></td>
<td><input type="text" size="5px"></td>
<td><label>:</label></td>
<td><input type="text" size="5px"></td>
<td><label style="padding-left:10px"><?php echo($Tim2Name); ?></label></td>
</tr>
<?php
$i++;
}
?>
<tr align="right" style="padding-top:5px">
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td><input type="submit" value="Insert" name="Insert"></td>
</tr>
</table>
If you did not understand my question, ask what ever you want and I’ll answer.
You can loop through the table using JQuery and extract values. I can’t understand what is the purpose of reading the data again from the table.. but try the code below:
suppose you have an id for your table,
Then use this JQuery script to loop through table rows;
If you want more help, please describe your scenario in more detail.
Hope this helps! 🙂