Hey everyone,
Not sure how helpful this is, but this is a multiplication table creator. The user has to enter the number of rows and columns, and the table will be created automatically.
<HTML>
<HEAD>
<TITLE>Multiplication Table <?php while(!empty($maxr) && !empty($maxc)) { print "of $maxr X $maxc";}?></TITLE>
</HEAD>
<BODY background = "bamboo.jpg" bgproperties = "fixed">
<?php include("navbar.php"); ?>
<font color = "black">
<form method="POST">
<table border = 0>
<tr>
<td><b>Number of Rows: </td><td><input type="text" size="20" name = 'nr'></td>
</tr><tr>
<td><b>Number of Columns: </td><td><input type="text" size="20" name = 'nc'></td>
</tr><tr>
<td></td><td><input type="submit" value="Submit"></td>
</tr>
</table>
</form>
<hr size="1">
<?php
$maxr = $_POST['nr'];
$maxc = $_POST['nc'];
if(!empty($maxr) && !empty($maxc)) {
for($n=1; $n<=$maxr; $n++) {
$rows[] = $n;
}
for($n=1; $n<=$maxc; $n++) {
$columns[] = $n;
}
print "<table cellspacing = \"0\">";
echo "<tr align = \"center\" bgcolor = \"dodgerblue\" height = \"15\">
<td bgcolor = \"white\" height = \"5\"> </td>";
foreach($rows as $val) {
print "<td width = \"20\">$val</td>";
}
echo "</tr>";
foreach($columns as $val) {
print "<tr height = \"20\">
<td bgcolor = \"dodgerblue\" width = \"20\">$val</td>";
foreach($rows as $value) {
$multi = $val * $value;
print "<td width = \"20\"><center>$multi</center></td>";
}
print "</tr>";
}
}else{
print "Please enter value for Columns and Rows!";
}
}
?>
</BODY>
</HTML>
Cheers