-
Notifications
You must be signed in to change notification settings - Fork 0
/
booking.php
252 lines (183 loc) · 7.29 KB
/
booking.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<?php
session_start();
if(!isset($_SESSION["s_name"]))
{
header("location: login.php");
}
$db=mysqli_connect("localhost","root","root","car_showroom");
if(isset($_POST['book']))
{
$cmodel = $_POST['model'];
$user = $_SESSION["s_name"];
$getmodelno= mysqli_query($db, "SELECT model from model where name = '".$cmodel."'");
$numrows1 =mysqli_num_rows($getmodelno);
if($numrows1 !=0)
{
while($row1=mysqli_fetch_assoc($getmodelno))
{
$dbmodelno=$row1['model'];
}
}
$checkcar= mysqli_query($db, "SELECT * from car where model = '".$dbmodelno."'");
$numrows3 =mysqli_num_rows($checkcar);
if($numrows3 !=0)
{
$getuserid= mysqli_query($db, "SELECT c_id from customer where name = '".$user."'");
$numrows2 =mysqli_num_rows($getuserid);
if($numrows2 !=0)
{
while($row2=mysqli_fetch_assoc($getuserid))
{
$dbuserid=$row2['c_id'];
}
}
$carupdate = " DELETE from car where model = '".$dbmodelno."' LIMIT 1 ";
mysqli_query($db, $carupdate);
$orderupdate = " INSERT into sale2 (customer_id,carmodel) VALUES ('$dbuserid', '$dbmodelno')";
mysqli_query($db, $orderupdate);
$message = "Booking succesfull! ";
echo "<script type='text/javascript'>alert('$message');</script>";
}
else
{
$message = "Oops ! the car you searching for is currently not available ! ";
echo "<script type='text/javascript'>alert('$message');</script>";
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title></title>
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div class="header">
<div class="wrap">
<div class="header-bot">
<div class="logo">
<a href="index.html"><img src="images/logo.png" alt="" style="width:450px; height: 160px;"></a>
</div>
<div class="cart">
<div>
<h3> Welcome <?=$_SESSION['s_name'];?> !! </h3>
</div>
<div class="menu-main">
<ul class="dc_css3_menu">
<li class="active"><a href="indexlogin.php">Home</a></li>
<li><a href="services.php">Brands</a></li>
<li><a href="booking.php">Book</a></li>
<li><a href="orders.php">Orders</a></li>
<li><a href="logout.php">Logout</a></li>
</ul>
<div class="clear"></div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
</div>
<div class="header-bottom">
<div class="wrap">
<div class="page-not-found">
<div class="text-center">
<h2>BOOK YOUR CAR !
</h2>
</div>
<div class="container-fluid row">
<div class="col-md-3"></div>
<div class="col-md-6">
<form class="text-center" action="booking.php" method="post" >
<div>
<label>Select Your Car Model</label><br>
<select name = "model" style="width:575px; height: 40px;" >
<option value = "">|--select car--|</option>
<option value = ""> </option>
<option value = "Land Cruiser Prado">Toyota Land Cruiser Prado</option>
<option value = "Fortuner"> Toyota Fortuner </option>
<option value = "Camry"> Toyota Camry </option>
<option value = "Innova Crysta"> Toyota Innova Crysta </option>
<option value = "Etios Cross">Toyota Etios Cross</option>
<option value = ""> </option>
<option value = "R8"> Audi R8</option>
<option value = "Q7"> Audi Q7 </option>
<option value = "RS7"> Audi RS7 </option>
<option value = "A8">Audi A8</option>
<option value = "TT"> Audi TT</option>
<option value = ""> </option>
<option value = "M4"> BMW M4 </option>
<option value = "X6"> BMW X6 </option>
<option value = "i8">BMW i8</option>
<option value = "M3"> BMW M3</option>
<option value = "X3"> BMW X3 </option>
<option value = ""> </option>
<option value = "Trailblazer"> Chervolet Trailblazer </option>
<option value = "Cruze">Chervolet Cruze</option>
<option value = "Sail"> Chervolet Sail</option>
<option value = "Beat"> Chervolet Beat </option>
<option value = "Volt"> Chervolet Volt</option>
<option value = ""> </option>
<option value = "Db11"> Aston Martin Db11 </option>
<option value = "Rapide">Aston Martin Rapide</option>
<option value = "Vanquish"> Aston Martin Vanquish</option>
<option value = "Vantage"> Aston Martin Vantage</option>
<option value = "vulcan"> Aston Martin vulcan</option>
<option value = ""> </option>
<option value = "Cedia"> Mitsubishi Cedia </option>
<option value = "Lancer">Mitsubishi Lancer</option>
<option value = "Montero"> Mitsubishi Montero</option>
<option value = "Outlander"> Mitsubishi Outlander </option>
<option value = "Pajero"> Mitsubishi Pjero</option>
<option value = ""> </option>
</select>
</div>
<div><br>
<button type="submit" name="book" class="btn btn-warning" value="book">Book the car</button>
</div>
</form>
</div>
<div class="col-md-3"></div>
</div>
</div>
</div>
</div>
<div class="footer">
<div class="wrap">
<div class="footer-top">
<div class="col_1_of_5 span_1_of_5">
<div class="footer-grid twitts">
<h3>Our Company</h3>
<div class="f_menu">
<ul>
<li>This is a CAR selling dealer</li>
<li>Please read our Terms and Conditions </li>
</ul>
</div>
</div>
</div>
<div class="col_1_of_5 span_1_of_5">
<div class="footer-grid twitts">
<h3>Get in touch</h3>
<ul class="follow_icon">
<li><a href="#" style="opacity: 1;"><img src="images/follow_icon.png" alt=""></a></li>
<li><a href="#" style="opacity: 1;"><img src="images/follow_icon1.png" alt=""></a></li>
<li><a href="#" style="opacity: 1;"><img src="images/follow_icon2.png" alt=""></a></li>
<li><a href="#" style="opacity: 1;"><img src="images/follow_icon3.png" alt=""></a></li>
<li><a href="#" style="opacity: 1;"><img src="images/follow_icon4.png" alt=""></a></li>
<li><a href="#" style="opacity: 1;"><img src="images/follow_icon5.png" alt=""></a></li>
</ul>
<p>+1 111-111-1111</p>
<span>[email protected]</span>
</div>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</body>
</html>