Austin's code output for Decisions and Loops:

Times Table Form

Build a Table

Code follows

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Times Table</title>
    <link rel="stylesheet" href="css/styles.css">
</head>
<body>

<div class="page">

    <p class="nav"><a href="../index.php">Home</a></p>

    <?php
    
include('includes/header.php');

    
// code
    
error_reporting(E_ALL);    // set error reporting to all

    
echo("<h1>Austin's code output for Decisions and Loops:</h1>");

    
$number = '';

    if (
$_SERVER['REQUEST_METHOD'] == 'POST')
    {
        
$number = trim($_POST['number']);

        
// decision: is the input valid? =====================

        
if (is_numeric($number) && $number >= 1 && $number <= 12)
        {
            echo(
'<h2>The ' . $number . ' times table</h2>');

            echo(
'<pre>');

            
// for loop: one line for each row =====================

            
for ($i = 1; $i <= 10; $i++)
            {
                
$product = $number * $i;

                
// decision: even or odd? =====================

                
if ($product % 2 == 0)
                {
                    
$label = 'even';
                }
                else
                {
                    
$label = 'odd';
                }

                echo(
$number . ' x ' . $i . ' = ' . $product . ' (' . $label . ")\n");
            }

            echo(
'</pre>');
        }
        else
        {
            echo(
'<p>Please enter a number from 1 to 12.</p>');
        }
    }

    echo(
'<h2>Times Table Form</h2>');
    
?>

    <form action="<?php echo(htmlspecialchars($_SERVER['PHP_SELF'])); ?>" method="post">

        <fieldset>
            <legend>Build a Table</legend>

            <label for="number">Number (1-12):</label>
            <input type="text" id="number" name="number" value="<?php echo(htmlspecialchars($number)); ?>">

            <input type="submit" value="Build Table">
        </fieldset>

    </form>

    <?php
    
include('includes/footer.php');
    
?>

    <br>

    <h2>Code follows</h2>

    <div class="code"><?php highlight_file(__FILE__); ?></div>

    <p class="nav nav-foot"><a href="../index.php">Home</a></p>

</div>

</body>
</html>