Php Script To Display Table Of 2

 

Input 2 in the form page as user can chose which number is to be displayed

Before Inputting Let's Prepare the Html Page


(Table.html)

<!DOCTYPE html>

<html>

<form method="POST" action="multi.php">

Enter Number:<input type="number" name="n1"><br>

<input type="submit">

</form>

</html>






Now Embed This Php Page into The Form tag.


<?php

$n=$_POST["n1"];

echo "$n is the table","<br>";

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

$table=$n*$i;

echo "$n x $i=$table","<br>";

}

?>













Comments