Friday, 13 April 2018

WT-Slip17



17)Write a PHP script to display a Multiplication table in tabular format. Design HTML page
 to accept a value.

<html>
<form method="post"action="">
<table align="center"border="1"cellpadding="8"cellspacing="0"width="50%">
<tr><td colspan="2"align="center"bgcolor="#8BFBE6"><h2>Multiplication Table</h2></td></tr>
<tr><td><b>Enter Number:</b></td><td><input type="text"name="number"value=""/></td></tr>
<tr><td colspan="2"align="center"><input type="submit"name="submit"value="submit"/></td></tr>
</table></form></html>
<?php
if($_POST['number']!='')
{
$number=$_POST['number'];
echo "<table border=1/>";
for($r=1;$r<=10;$r++)
{
echo('<tr>');
echo('<td>'.$r*$number.'</td>');
echo('</tr>');
}
echo('</table>');
}
?>