while loops for rows in PHP -
new php , i'm trying have 8 rows 2 cells using while loop. can't seem right, i've played code lot comes out wrong. point in right direction appreciated
<section class="grabber2"> <?php $x = 0; echo '<tr>'; while ($x < 4){ echo '<td> phrase 1!</td>', '<td> phrase 2!</td>'; $x++; } ?></tr> </section>
tr comes before td. tr=table row. td=table column
try this:
<table> <?php $x = 0; while ($x < 8){ echo '<tr>'; echo '<td> phrase 1!</td><td> phrase 2!</td>'; echo '<tr>'; $x++; } ?> </table>
section tag useful apply css styling components. don't need in case. also, try use nested <div>
tags instead of <table>
.
Comments
Post a Comment