Use for loop to output HTML table
<HTML>
<HEAD>
<TITLE>Value of Shares</TITLE>
<H3>Table Showing Cost of Shares</H3>
<BODY>
<TABLE BORDER=1>
<?php
for ($shares = 1; $shares <= 20; $shares++){
$cost = $shares * 20;
echo "<TR><TD>The cost of $shares share/s is $cost #x0024s</TD>","\n";
$dividend = $cost * 0.10;
echo "<TD>The dividend is $dividend #x0024s</TD></TR> " ,"\n";
}
?>
</TABLE>
</BODY>
</HTML>
Related examples in the same category