Yomix Yomix - 1 year ago 44
HTML Question

How put a <tr> element inside a <li>?

I want to know how to put a '<'tr> element inside a '<'li>. I'm using data from a server (localhost) through of PHP. I try to place that data inside of table cells and put these cells within a '<'li> belonging to an ordered list. I do this as an exercise to create a kind of To-do list but which contain images, buttons, and other things ... that's why I need to create this structure.
The data is entered into the table using a for each construct but adding a '<'li>, this appears outside. If anyone has any solution I will be immensely grateful.

Thanks a lot for your attention and help.
Have a good day.

enter image description here

Answer Source

You can not mix ol with table or li with tr - these are totally different structures.

If you want to have ordered rows in table just add another td and put there numbers, eg <?php echo ++$i; ?>


$i = 0;
foreach($resultados as $fila) {
echo '<tr>';
echo '<td> ' . ++$i . '</td>';
echo '<td> ' . $fila['value'] . '</td>';
//and others your columns

echo '</tr>';