0
How to add text in PHP tables?
I'm beginner in PHP, I want to learn how to make a table that contains text. I will insert example that I found on the Internet but that's just a table via for loop, but I want to type text inside the table. <?php echo '<table border="1">'; $i = 0; for($i =1; $i<=4; $i++){ echo '<tr> <td>'.$i.'</td>'; $x = 0; for($x=1; $x<=4; $x++){ $y = $x + $i; $z = ($y>5) ? $y-5 : $y; echo '<td>'.$z.'</td>'; } echo '</tr>'; } echo '</table>'; ?>
1 Answer
+ 3
//Remove loop and add text
<?php
echo '<table border="1">';
echo '<tr> <td>test</td>';
echo '<td>test</td>';
echo '</tr>';
echo '</table>';
?>