Number | Square Value |
1 | 1 |
2 | 4 |
3 | 9 |
4 | 16 |
5 | 25 |
6 | 36 |
7 | 49 |
8 | 64 |
9 | 81 |
10 | 100 |
Code:
<html>
<head>
<title>PHP TEST YAHHH</title>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
<body>
<div class="topbar">
<?php
include 'navbar.php';
?>
</div>
<table cellspacing ="4" cellpadding ="4" border="1">
<?php
//looooooooooooooooooooooops
$num = 1;
echo '<tr bgcolor=#E82C0C>';
echo '<td>';
echo 'Number';
echo '</td>';
echo '<td>';
echo 'Square Value';
echo '</td>';
echo '</tr>';
while ($num < 11)
{
$numSquare = $num * $num;
if ($num % 2 == 0)
{
echo '<tr bgcolor=#FF530D>';
}
else
{
echo '<tr bgcolor=#FF7C67>';
}
echo '<td>';
echo $num;
echo '</td>';
echo '<td>';
echo $numSquare;
//echo '<br>';
$num++;
echo '</td>';
echo '</tr>';
}
echo '<br>';
/* outputs in this format:
*/
?>
</table>
<div class="codebox">
<h3>Code:</h3>
<?php
highlight_file("ex018.php");
?>
</div>
</body>
</html>