Wednesday, January 20, 2016

PHP: dynamic HTML table

PHP: Quantity Price Data

<?php
$price_unit=5.53;

$init_qty=10;

echo "<table border='1' >";
echo "<tr><td>Quantity</td><td>Price</td></tr>";

while($init_qty<=100){
echo "<tr>";
echo "<td>$init_qty</td>";
echo "<td>$";
printf("%.2f",($price_unit*$init_qty));
echo "</td>";
$init_qty+=10;
echo "</tr>";

}

echo "</table>";

?>

No comments:

Post a Comment