function ShowResultsForm() { if (isset($_POST['Cust_Type'])) { $customer = $_POST['Cust_Type']; } else { $customer = NULL; } if (isset($_POST['Num_Copies'])) { $copies = $_POST['Num_Copies']; } else { $copies = 0; } $Subtotal = number_format(GetCostOfPage($customer) * $copies, 2); $Tax = number_format(GetCostOfPage($customer) * $copies * 0.13, 2); $Total = number_format(CalculateTotal($Subtotal, $Tax), 2); echo "<h1> Customer Info </h1>\n <p> Customer Type:" . $customer . " </p>\n <p> Number of Copies " . $copies . " </p>\n <p> Subtotal: " . "\$" . $Subtotal . " </p>\n <p> Tax Amount: " . "\$" . $Tax . " </p>\n <p> Total: " . "\$" . $Total . " </p>\n "; }
include 'git_ItemClass.php'; include 'git_ItemFunctions.php'; $menuItems[] = new Item("Tacos", 2.5, "Two Tacos made with your choice of meat. lettuce and guacamole"); $menuItems[] = new Item("Burrito", 4.5, "Your choice of meat, rice, beans, tomato and grilled onions wrapped in a tortilla skin"); $menuItems[] = new Item("Chimichanga", 4.75, "Deep Fried Burrito Goodness!"); $menuItems[] = new Item("Quesadilla", 3.5, "Cheese and choice of meat, grilled to perfection"); $menuItems[] = new Item("Horchata", 2.0, "Wash it down with our delicious, authentic Horchata"); $menuItems[] = new Item("Sodas", 1.5, "Take your pick of our Mexican sodas!"); $menuItems[] = new Item("Churros", 1.5, "Fried dough sprinkled with cinnamon and sugar."); ?> <html> <?php if (!isset($_POST['orderedItems'])) { echo ' <form action = "' . $_SERVER['PHP_SELF'] . '" method = "POST"> <table>'; echo '<tr><th>Menu:</th></tr>'; echo '<tr><td> Item: </td> <td> Description: </td> <td> Price: </td><td> Quantity: </td></tr>'; foreach ($menuItems as $tempItem) { generateItemRow($tempItem); //call create row function and pass in individual item } echo ' <tr><td><input type = "submit" name = "orderedItems" value ="Submit Order"></td> </tr> </table> </form> '; } else { CalculateTotal($_POST, $menuItems); echo '<br>'; echo '<a href=' . $_SERVER['PHP_SELF'] . '> Place Another Order! </a>'; }