All pastes #937352 Raw Edit

Stuff

public text v1 · immutable
·published 2008-03-10 23:34 UTC
rendered paste body
<?php
if (!empty($_POST['numTimes'])) { // this thing took a fair amount of time.
$times = $_POST['numTimes'];

echo "<table border=\"1\">";
for($i = 0; $i < ($times + 1); $i++){
  if($i == 0){
    echo "<tr><td></td>";
    foreach(range(1, $times) as $num) echo "<td><b>$num</b></td>";   
    echo "</tr>";
  }else{
    echo "<tr><td><b>$i</b></td>";
    foreach(range(1, $times) as $num) echo "<td>".$i * $num."</td>";
    echo "</tr>";
  }
}
echo "</table>";
}

else {
echo <<<HTML
<style type="text/css">
<!--
.someStyle {
	font-family: Calibri;
	color: #0000FF;
	font-size: 12px;
}
.someBiggerStyle {
	font-family: Calibri;
	color: #0000FF;
	font-size: 16px;
	font-weight: bold;
}
-->
</style>
<span class="someBiggerStyle">Input Number of Rows and Columns for Multiplication Table </span><br>
<form action="{$_SERVER['PHP_SELF']}" method="get">
  <p>
    <input name="numTimes" type="text">
 
    <input type="submit" name="Submit" value="Submit">
    
</p>
</form>
HTML;
}
?>