Multiplication table of specific number. (Eg: 7)
<?php
$number = 7;
echo "Multiplication table for $number:<br>";
for ($i=1; $i<=10;$i++)
{
echo "$number x $i = ".($number * $i)."<br>";
}
?>
User Defined Multiplication table.
<?php
if(isset($_POST['submit']))
{
$number = $_POST['num'];
echo "Multiplication table for $number:<br>";
for ($i = 1; $i <= 10; $i++)
{
echo "$number x $i = " . ($number * $i) . "<br>";
}
}
?>
<form method="post">
Enter a number: <input type="number" name="num">
<input type="submit" name="submit" value="Generate">
</form>