Пример #1
0
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();
?>
</html>
Пример #2
0
    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 . "&#160&#160 x &#160&#160  " . SeatName($seatType) . "</td>";
        echo "<td>\$" . TicketCost($seatType, $i) * $quantity . "</td>";
        echo "</tr></table>";
        echo "</div>";
        fwrite($Checkout, TicketCost($seatType, $i) * $quantity . ", ");
    }
    //echo "Voucher discount:";
    echo "<div class='tTotal'>";
    echo "TOTAL:&#160&#160&#160&#160&#160&#160&#160&#160&#160&#160&#160&#160&#160 ";
    echo "\$" . $subtotal;
    echo "</div>";
    fwrite($Checkout, $subtotal . ", ");
    //echo "<hr>";
    echo "</div>";
}
?>
Пример #3
0
            
            
        <?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>";
    echo "<div id='delete'>\n                    <a id='link' href='DeleteFromCart.php?var={$i}'>Delete from Cart</a></div>";
    echo "<input type='text' id='qty' maxlength='2'>";
    echo "<div id='delete'>\n                    <a id='link' href='UpdateCart.php'>UPDATE CART</a></div>";
}
?>