-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd-cart.php
38 lines (29 loc) · 908 Bytes
/
add-cart.php
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
34
35
36
37
38
<?php
session_start();
if($_SESSION["customer-login"] != "true"){
header('Location: login.php');
}
?>
<!DOCTYPE html>
<html lang="en">
<?php
$message = "";
if($_SERVER["REQUEST_METHOD"]=="GET"){
require_once("connect-db.php");
$customer_id = $_GET["customer_id"];
$menu_id = $_GET["menu_id"];
$sql = "INSERT INTO customer_order (customer_id, menu_id) VALUES (:customer_id, :menu_id)";
$statement = $db->prepare($sql);
$statement->bindValue(":customer_id", $customer_id);
$statement->bindValue(":menu_id", $menu_id);
}
if($statement->execute()){
$statement->closeCursor();
$message = "<h4>The item has been added to cart.</h4>";
}else{
$message = "<h4>Error adding to cart.</h4>";
}
?>
<script>
window.location.replace("menu.php");
</script>