-
Notifications
You must be signed in to change notification settings - Fork 0
/
final.php
36 lines (28 loc) · 877 Bytes
/
final.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
<?php
include('connection.php');
session_start();
header('location:index.php');
echo 'alert("order placed")';
$quall = count($_SESSION['cart']);
$pricet = $_SESSION['pri'];
echo $_SESSION['pri'];
echo $quall;
$name = $_SESSION['cust'];
echo $name;
foreach($_SESSION['cartprod'] as $key=>$value){
echo "value".$value."<br>";
echo $key;
}
echo $name;
$query = "SELECT customer_id FROM customer WHERE customer_name ='$name'";
$data = mysqli_query($conn, $query);
$result1 = mysqli_fetch_assoc($data);
$custtt = $result1['customer_id'];
echo $custtt;
$qy = "insert into cart(cart_id, quantity, totalprice, customer_id) values('$custtt','$quall', '$pricet', '$custtt')";
mysqli_query($conn, $qy);
foreach($_SESSION['cartprod'] as $key=>$value){
$qy2 = "INSERT into cp(cart_id, id) values('$custtt','$value');";
mysqli_query($conn, $qy2);
}
?>