Skip to content

Instantly share code, notes, and snippets.

@wingyplus
Created July 11, 2011 14:56
Show Gist options
  • Save wingyplus/1076023 to your computer and use it in GitHub Desktop.
Save wingyplus/1076023 to your computer and use it in GitHub Desktop.
lab midterm exam
<html>
<body>
<form action="process.php" method="post">
<center>
Input a number(1-99)
<input type="text" name="num" size="2" maxlength="2"/><br/>
<input type="submit" value="Submit It!"/>
<input type="reset" value="Clear It!"/>
</center>
</form>
</body>
</html>
<?php
if (isset($_POST)) {
$start = 2;
$end = 12;
echo "<pre>1234567890123456789012345678901234567890";
for ($i = 1; $i <= $end; $i++) {
if ($i >= 10)
echo "<br>&nbsp;&nbsp;&nbsp;$i&nbsp;&nbsp;&nbsp;$i";
else
echo "<br>&nbsp;&nbsp;&nbsp;&nbsp;$i&nbsp;&nbsp;&nbsp;&nbsp;$i";
for ($j = $start; $j <= $_POST["num"]; $j++) {
if ($i * $j >= 10) {
echo "&nbsp;&nbsp;&nbsp;" . $i * $j;
} else {
echo "&nbsp;&nbsp;&nbsp;&nbsp;" . $i * $j;
}
}
}
echo "</pre>";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment