Answer the question
In order to leave comments, you need to log in
how to populate html table using php?
I have a table in html
<table class="table" disabled>
<thead>
<tr>
<th style="text-align: center; color:#66bb6a;" width="250">Ф</th>
<th style="text-align: center; color:#66bb6a;" width="250">И</th>
<th style="text-align: center; color:#66bb6a;" width="250">ОE</th>
</tr>
</thead>
<tbody>
<tr>
</tr>
</tbody>
</table>
for($i = 0; $i < sizeof($fioList); $i++)
{
echo '
<td>'.$leadLists[$i]['f'].'</td>
<td>'.$leadLists[$i]['i'].'</td>
<td>'.$leadLists[$i]['o'].'</td>
';
}
Answer the question
In order to leave comments, you need to log in
add php code to html table
<tbody>
<?php
for($i = 0; $i < sizeof($fio); $i++)
{
echo '
<tr>
<td>'.$leadLists[$i]['f'].'</td>
<td>'.$leadLists[$i]['i'].'</td>
<td>'.$leadLists[$i]['o'].'</td>
</tr>
';
}
?>
</tbody>
</table>
The php code inserts the result of its work in the place where it is written . If this php code is inside your html table, it will insert the result there (which is what you want). If this code is somewhere else, it will insert it in another place, and the browser will display it outside the table, of course.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question