-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshoppingcart.php
108 lines (59 loc) · 2.09 KB
/
shoppingcart.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
// Start the session
session_start();
include_once 'dbconnect2.php';
$type = $_POST["type"];
date_default_timezone_set("America/Chicago");
$t=time();
$time = date("Y-m-d h:i:s");
if(!isset($_SESSION['user'])){
header("Location: customersignin.html");
}else{
$user = $_SESSION['user'];
if($type =="all" || $type =="onewaynonstop" ){
$flightno = $_POST["flightno"];
$class = $_POST["classtype"];
$price = $_POST["price"];
$date = $_POST["date"];
$sql = "INSERT INTO book (time, date, flightno, username, classtype, paid)
VALUES ('$time', '$date', '$flightno', '$user', '$class', '0')";;
$result = mysqli_query($con,$sql);
header("Location: cartshow.php");
}
if($type =="oneway1stop"){
$flightno = $_POST["flightno"];
$class = $_POST["classtype"];
$price = $_POST["price"];
$date = $_POST["date"];
$flightno2 = $_POST["flightno2"];
$class2 = $_POST["classtype2"];
$price2 = $_POST["price2"];
$sql = "INSERT INTO book (time, date, flightno, username, classtype, paid)
VALUES ('$time', '$date', '$flightno', '$user', '$class', '0')";;
$result = mysqli_query($con,$sql);
$sql2 = "INSERT INTO book (time, date, flightno, username, classtype, paid)
VALUES ('$time', '$date', '$flightno2', '$user', '$class2', '0')";;
$result2 = mysqli_query($con,$sql2);
header("Location: cartshow.php");
}
if($type =="roundtrip"){
$flightno = $_POST["flightno"];
$class = $_POST["classtype"];
$price = $_POST["price"];
$date = $_POST["date"];
$flightno2 = $_POST["flightno2"];
$class2 = $_POST["classtype2"];
$price2 = $_POST["price2"];
$returndate = $_POST["date2"];
$sql = "INSERT INTO book (time, date, flightno, username, classtype, paid)
VALUES ('$time', '$date', '$flightno', '$user', '$class', '0')";;
$result = mysqli_query($con,$sql);
$sql2 = "INSERT INTO book (time, date, flightno, username, classtype, paid)
VALUES ('$time', '$returndate', '$flightno2', '$user', '$class2', '0')";;
$result2 = mysqli_query($con,$sql2);
header("Location: cartshow.php");
}
echo "Error adding to cart..";
}
mysqli_close($con);
?>