global $con; $ip = getIp(); if (isset($_POST['update_cart'])) { foreach ($_POST['remove'] as $remove_id) { $delete_product = "delete from cart_ece where p_id='{$remove_id}' AND ip_add='{$ip}'"; $run_delete = mysqli_query($con, $delete_product); if ($run_delete) { echo "<script> window.open('cart.php','_self')</script>"; } } } if (isset($_POST['continue'])) { echo "<script> window.open('index_ece.php','_self')</script>"; } } echo @($up_cart = updatecart()); ?> </div> </div> </div> <div id="footer"> <h2 style="text-align:center;padding-top:30px;">©2015 by www.aaa.com</h2> </div> </body>
function deletecart() { $x = $_REQUEST['chktid']; for ($i = 0; $i < count($x); $i++) { mysql_query("delete from cart where tid={$x[$i]}"); } header("location:cart.php"); } function createitem() { } function insertcart() { } function updatecart() { } switch ($y) { case 'deletecart': deletecart(); break; case 'insertcart': insertcart(); break; case 'updatecart': updatecart(); break; case 'createitem': createitem(); break; }
function updatecart() { global $con; $ip = getIp(); if (isset($_POST['update_cart'])) { foreach ($_POST['remove'] as $remove_id) { $delete_product = "delete from cart where p_id='{$remove_id}' and ip_add='{$ip}'"; $run_delete = mysqli_query($con, $delete_product); if ($run_delete) { } echo "<script>window.open('cart.php','_self')</script>"; } } if (isset($_POST['continue'])) { echo "<script>window.open('index.php','_self')</script>"; } echo @($up_cart = updatecart()); }