PHP: Solution 4


Introduction | Static vs. Dynamic Websites | Using PHP on RCI or Eden | A Simple PHP Program | Practice 1 | Loops | Practice 2 | Functions | Practice 3 | Conditionals | Practice 4 | PHP and Online Forms | Practice 5 | PHP and E-mail | Practice 6 | Conclusion


The solution to practice 4 is the following. The parts that you had to fill in have been made bold so you can view the soloution with ease.

<html>
<table border="1" cellpadding="3">

<tr>
<? for($i = 1; $i < 9; $i++) { ?>
        <td align="center">
        <? echo $i; ?>
        </td>
<? } ?>
</tr>

<tr>
<? for($i = 1; $i < 9; $i++) { ?>
        <td align="center">
        <?
        if($i > 5) {
                echo "yes";
        }
        else {
                echo "no";
        }              
        ?>
        </td>
<? } ?>
</tr>
</table>
</html>



edseries@nbcs.rutgers.edu