<table class="table table-condensed"> <thead> <tr class="cart_menu"> <td>Restaurant</td> <td>Item</td> <td class="price">Price</td> <td class="quantity">Quantity</td> <td class="total">Total</td> <td></td> <td></td> </tr> </thead> <tbody> <?php $username = $_SESSION['username']; checkCart($username); ?> </tbody> </table> </div> <div <div style="float:right; padding-right:30px;"> <button id="btn_go_check" class="btn btn-primary" name="btn_go_check" onclick="window.location.href='checkout.php'">Go to Checkout</button> </div> </div> </div> </section> <!--/#cart_items--> <footer id="footer"><!--Footer--> <div class="footer-top">
<?php session_start(); include '../BLL.getData.php'; $bllGetData = new BLL_manageData(); /* array which will store the cart values provided by the user this will help us to manipulate the values if a user has incremented * the cart values by changing the functions of js_cart.js */ $userArray = array(); if ($_SERVER['REQUEST_METHOD'] == 'GET') { $userCart = $GLOBALS['_COOKIE']; checkCart($userCart, $bllGetData, $userArray); } function checkCart($userCart, $bllGetData, $userArray) { $queryString = ''; //string will be used to do db query //checks whether the usercart is filled or not, this step is for malicious request done on this page if ($userCart['cart_is_selected'] == 'yes' && count($userCart) > 3) { foreach ($userCart as $key => $userProduct) { if (substr($key, 0, 10) == 'no_product') { /* pushes only those values which is in the cart * in the format of * $userArray = Array ( [0] => no_productP_001 [1] => 1 [2] => no_productP_002 [3] => 1 [4] => no_productP_003 [5] => 7