-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcheckout.php
157 lines (132 loc) · 3.83 KB
/
checkout.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<html>
<head>
<title>The Bliss - We Got Your Event</title>
<link rel="icon" href="Images/WEB logo.png" type="image/gif"> <!--icon next to the title-->
<link rel="stylesheet" type="text/css" href="The Bliss.css">
<script language="javascript" type="text/javascript" src="The Bliss.js"></script>
<style>
#labels /*1st columns*/
{
height:60px;
color:black;
font-size:22px;
font-family:trebuchet ms;
font-weight:bold;
padding-left:8px;
}
#textboxes /*2nd columns*/
{
font-size:17px;
width:260px;
font-family:trebuchet ms;
padding:8px;
}
</style>
</head>
<body>
<?php
$servername = "localhost";
$user = "root";
$pw = "";
$db = "TheBliss";
$connection = mysqli_connect($servername, $user, $pw, $db); /*connecting the database*/
if(!$connection)
{
die("Connection failed: " .mysqli_connect_error());
}
$selectqry = "SELECT * from cart";
$result=mysqli_query($connection,$selectqry);
if(mysqli_num_rows($result)==0)
{
echo "<center>
<div>
<img src='Images/WEB logo.png' width='250px' height='250px'>
</div>
<div style='background-color:black;
font-family:trebuchet ms;
font-size:40px;
color:#f1f1f1;
padding:5px;
margin-top:20px;
border-radius:30px;
width:65%;'>
Your cart is empty!
</div>
</center>";
?>
<center>
<div>
<input type="button" name="redirect" value="Continue Shopping" id="submitButton" class="bothButtons" onclick="Home()" style="font-size:35px; margin-top:50px; border-radius:5px;">
</div>
</center>
<?php
}
else
{
?>
<table width="100%">
<tr>
<td><img src="Images/WEB logo.png" width="130px" height="130px" style="padding:10px;"></td>
<td width="80%"><font style="margin-left:280px; background-color:black; color:white; border-radius:40px; padding:15px; font-family:trebuchet ms; font-size:30px; font-weight:bold;">Enter shipping details!</font></td>
</tr>
</table>
<center>
<div>
<form name="checkout" method = "POST" action = "http://localhost/TheBliss/order.php"> <!--COLLECTING SHIPPING DETAILS-->
<table>
<tr>
<td width="280px" id="labels">First Name</td> <!--First name-->
<td><input type="text" name="fname" placeholder="Enter First Name" id="textboxes"></td>
</tr>
<tr>
<td id="labels">Last Name</td> <!--User name-->
<td><input type="text" name="lname" placeholder="Enter Last Name" id="textboxes"></td>
</tr>
<tr>
<td id="labels">Address</td> <!--address-->
<td><input type="text" name="address" placeholder="Enter address" id="textboxes"></td>
</tr>
<tr>
<td id="labels">E-mail</td> <!--email-->
<td><input type="email" name="mail" placeholder="Enter E-mail" id="textboxes"></td>
</tr>
<tr>
<td id="labels">Phone</td> <!--phone number-->
<td><input type="text" name="phone" placeholder="Enter Phone" id="textboxes"></td>
</tr>
<tr>
<td id="labels">Description</td> <!--description-->
<td><textarea name="description" rows=5 placeholder="Description if any (eg:- number candles for age 12)" id="textboxes"></textarea></td>
</tr>
<tr>
<td colspan=2 align="center">
<input type="submit" name="submit" value="Place Order" id="submitButton" class="bothButtons">
<input type="reset" name="cancel" value="Cancel" id="cancelButton" class="bothButtons">
</td>
</tr>
</table>
</form>
<table>
<tr>
<?php
if(mysqli_num_rows($result)>0)
{
while($row=mysqli_fetch_assoc($result))
{
?>
<td style="padding:10px;">
<img src="<?php echo $row["pimage"]; ?>" width="180px" height="180px">
</td>
<?php
}
}
?>
</tr>
</table>
</div>
</center>
<?php
}
?>
</body>
</html>