include 'functions.php'; for ($i = 0; $i < sizeof($_SESSION['cart']); $i++) { $subtotal = 0; $totalQuantity = 0; foreach ($_SESSION['cart'][$i]['seats'] as $seatType => $quantity) { $subtotal = $subtotal + TicketCost($seatType, $i) * $quantity; $totalQuantity = $totalQuantity + $quantity; } //printing each ticket for ($j = 1; $j <= $totalQuantity; $j++) { echo "<img id='tktpic' src='tickett.png' height='350px' width='50px'>"; echo "<div id=subticket>"; echo "<div id=tktheading>"; echo "SILVERADO CINEMAS"; echo "</div>"; echo "<p>" . MovieName($_SESSION['cart'][$i]['movie']) . "</p>"; echo "<p>" . Day($_SESSION['cart'][$i]['day']); echo ", " . $_SESSION['cart'][$i]['time'] . "PM </p>"; foreach ($_SESSION['cart'][$i]['seats'] as $seatType => $quantity) { echo "<br><br>"; } echo SeatName($seatType) . "<br>"; echo "Seat " . $j; echo "</div>"; } } ?> </body> <?php session_unset(); ?>
include 'functions.php'; for ($i = 0; $i < sizeof($_SESSION['cart']); $i++) { //echo "<hr>"; echo "<div id='ticket'>"; $subtotal = 0; $imgsrc = Image($_SESSION['cart'][$i]['movie']); echo "<img id='poster' src={$imgsrc} alt='poster'>"; echo "<div class='cDetails'>"; echo $_POST['Name'] . "<br>"; echo $_POST['PhNumber'] . "<br>"; echo $_POST['Email'] . "<br>"; echo "</div>"; echo "<div class='mDetails'>"; echo "SILVERADO CINEMAS"; echo "<p>" . MovieName($_SESSION['cart'][$i]['movie']) . "</p>"; fwrite($Checkout, MovieName($_SESSION['cart'][$i]['movie']) . ", "); echo "<p>" . Day($_SESSION['cart'][$i]['day']); fwrite($Checkout, Day($_SESSION['cart'][$i]['day']) . ", "); echo ", " . $_SESSION['cart'][$i]['time'] . "PM </p>"; fwrite($Checkout, $_SESSION['cart'][$i]['time'] . "PM, "); echo "</div>"; foreach ($_SESSION['cart'][$i]['seats'] as $seatType => $quantity) { fwrite($Checkout, SeatName($seatType) . ", "); $subtotal = $subtotal + TicketCost($seatType, $i) * $quantity; echo "<div class='tDetails'>"; echo "<table>\n <tr>\n <td>" . $quantity . "   x    " . SeatName($seatType) . "</td>"; echo "<td>\$" . TicketCost($seatType, $i) * $quantity . "</td>"; echo "</tr></table>"; echo "</div>"; fwrite($Checkout, TicketCost($seatType, $i) * $quantity . ", "); }
<p class="heading"> VIEW CART </p> <?php //session_unset(); //print_r($_SESSION); include 'functions.php'; $total = 0; for ($i = 0; $i < sizeof($_SESSION['cart']); $i++) { echo "<div id='ticket'>"; // echo "<hr>"; echo "<br><p class='MovieName' >" . MovieName($_SESSION['cart'][$i]['movie']) . "</p>"; $subtotal = 0; echo "<table>\n <tr>\n <th>Ticket Type</th>\n <th>Cost</th>\n <th>Qty</th> \n <th>Subtotal</th>\n </tr>"; foreach ($_SESSION['cart'][$i]['seats'] as $seatType => $quantity) { echo "<tr>"; echo "<td>" . SeatName($seatType) . "</td>"; echo "<td id='txtCost'> \$" . TicketCost($seatType, $i) . "</td>"; echo "<td id='txtQty'>" . $quantity . "</td>"; $subtotal = $subtotal + TicketCost($seatType, $i) * $quantity; echo "<td id='subcost'> \$" . TicketCost($seatType, $i) * $quantity . "</td>"; echo "</tr>"; } echo "\n <tr>\n <td colspan='3' style='text-align: right'>Subtotal</td>\n \n <td>\${$subtotal}</td>\n </tr>"; $total = $total + $subtotal; echo "</table>"; echo "</div>";