<?php
include('includes/header.php');
error_reporting(E_ALL); // Set error reporting to all
echo "<h1>Multiplication Table Generator</h1>";
// Check if the form was submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$number = $_POST['number'];
// To make sure if the user input is a positive number
if ($number > 0) {
echo "<h2>Multiplication Table for $number</h2>";
// Use a forloop to generate the multiplication table
for ($i = 1; $i <= 10; $i++) {
$result = $number * $i;
echo "<p>$number x $i = $result</p>";
}
} else {
echo "<p>Please enter a positive number.</p>";
}
} else {
echo '
<form method="post">
<label for="number">Enter a positive number:</label>
<input type="number" id="number" name="number" required>
<button type="submit">Generate Table</button>
</form>';
}
include('includes/footer.php');
?>
<div id="home"><a href="https://citw.lcc.edu/~sperlt/citw185/index.php">Tedd Work</a></div>