0

How can i output this in a table?

<?php echo "Cashier Name: Ajumobi Jegede"; echo "<p>XYZ Stores</p>"; echo "<p>NO.5 Ibori Street</p>"; echo "<p>Warri, Delta State</p>"; $mouse = 800 * 10; $stapler = 2000 * 20; $ballPen = 1500 * 35; $writingPad = 1000 * 40; $totalPrice = $mouse + $stapler + $ballPen + $ballPen + $writingPad; $vatAmount = $totalPrice * 0.06; $totalBill = $vatAmount + $totalPrice; echo "<p>Product Unit Price Quantity Ordered Total Cost</p>"; echo "<p>Mouse N800.00 10 $mouse</p>"; echo "<p>Stapler N2000.00 20 $stapler</p>"; echo "<p>Ball Pen N1500.00 35 $ballPen</p>"; echo "<p>Writing Pad N1000.00 40 $writingPad</p>"; echo "<p>Valut Added Tax(VAT) is 6%</p>"; echo "<p>Your Total Bill is $totalBill </p>"; ?>

17th Feb 2017, 10:31 AM
Oyebode Aduragbemi
Oyebode Aduragbemi - avatar
1 Réponse
+ 1
This is not a Php question, really, it's a Html one ^^ I wrote just the modified code from yours, and let you style it: ?> <table> <thead> <tr> <td>Product</td> <td>Unit Price</td> <td>Quantity Ordered</td> <td>Total Cost</td> </tr> </thead> <tbody> <tr> <td>Mouse</td> <td>N800.00</td> <td>10</td> <td><?php echo $mouse; ?></td> </tr> <tr> <td>Stapler</td> <td>N2000.00</td> <td>20</td> <td><?php echo $stapler; ?></td> </tr> <tr> <td>Ball pen</td> <td>N1500.00</td> <td>35</td> <td><?php echo $ballPen; ?></td> </tr> <tr> <td>Writting Pad</td> <td>N1000.00</td> <td>40</td> <td><?php echo $writingPad; ?></td> </tr> </tbody> </table> <?php ... this kind of structure could surely be improved by a loop to generate it ;) ( but the html structure is more readable without )
17th Feb 2017, 9:42 PM
visph
visph - avatar