-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelcart.php
More file actions
35 lines (28 loc) · 1.11 KB
/
delcart.php
File metadata and controls
35 lines (28 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php include ("inc/header.php") ;?>
<?php
// Assuming $db is an instance of the Database class
if (!isset($_GET['cartId']) || $_GET['cartId'] == NULL) {
echo "<script>window.location = 'cart.php';</script>";
} else {
$cartId = $_GET["cartId"];
$query = "SELECT * FROM tbl_cart WHERE cartId='$cartId'";
$getData = $db->select($query);
if ($getData) {
$delquery = "DELETE FROM tbl_cart WHERE cartId='$cartId' ";
$delData = $db->delete($delquery);
// Redirect to show all data in the table again after deleting a row
//echo '<meta http-equiv="refresh" content="0;url=cart.php">';
if ($delData) {
$msg = "<span class='msg-alt'>Delete Data!</span>";
} else {
$msg = "<span class='msg-alt'>Failed To Delete Data!!</span>";
}
// Return the response message
echo $msg;
echo '<meta http-equiv="refresh" content="0;url=menuitems.php?tableid='.urlencode($tableid).'">';
// header("Location: menuitems.php?tableid=" . urlencode($tableid));
exit();
}
};
?>
<?php include ("inc/footer.php") ;?>