Solution 4

Main | Static vs. Dynamic Websites | Using PHP | A Simple PHP Program | Variables and Operators | Practice 1 | Solution 1 | Loops | Practice 2 | Solution 2 | Functions | Practice 3 | Solution 3 | Conditionals | Practice 4 | Solution 4

The solution to practice 4 is the following. The parts that you had to fill in have been underlined 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>

This completes the first of four modules for WBM-527.


jfulton [at] member.fsf.org
22 Aug 2013