-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhistory.php
123 lines (115 loc) · 4.47 KB
/
history.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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<link rel="stylesheet" href="style.css" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Welcome to Bus Booking</title>
<link rel="stylesheet" type="text/css" href="xres/css/style.css" />
<link rel="icon" type="image/png" href="xres/images/favicon.png" />
<link type="text/css" href="css/styles.css" rel="stylesheet" media="all" />
</head>
<?php
Include('db.php');
if(isset($_REQUEST['submit7'])!='')
{
$id_no =$_REQUEST['id_no'];
$no = $_REQUEST['no'];
$bdate = $_REQUEST['bdate'];
$q="SELECT *FROM businfo where id_no='$id_no' and DATE(bdate)='$bdate' ";
$r=mysqli_query($con,$q)or die(mysqli_error($con));
while ($row = mysqli_fetch_array($r, MYSQLI_BOTH)) {
$seat=$row['seat'] ;
}
if($_REQUEST['cname']=='' || $_REQUEST['startP']==''|| $_REQUEST['desP']==''||$_REQUEST['type']=='')
{
echo "please fill the empty field.";
}
else if($seat>$no)
{
$cname =$_REQUEST['cname'];
$id_no =$_REQUEST['id_no'];
$startP = $_REQUEST['startP'];
$desP = $_REQUEST['desP'];
$no = $_REQUEST['no'];
$mob_no = $_REQUEST['mob_no'];
$type = $_REQUEST['type'];
$bdate = $_REQUEST['bdate'];
$payment = $_REQUEST['radio'];
$query = "INSERT into `cusinfo` ( id_no,cname, startP, desP,no,mob_no,type,bdate,payment)VALUES ('$id_no','$cname', '$startP', '$desP','$no','$mob_no','$type','$bdate','$payment')";
$result = mysqli_query($con,$query);
if($result){
echo '<script type="text/javascript">';
echo ' alert("Booking is successful")';
echo '</script>';
$q = "update businfo set seat=(seat-'$no') where startP='$startP' and desP='$desP' and type='$type' and DATE(bdate)='$bdate' ";
$r = mysqli_query($con,$q);
}
else
{
echo '<script type="text/javascript">';
echo ' alert("There is some problem in booking bus")';
echo '</script>';
}
}
else
{
echo '<script type="text/javascript">';
echo ' alert("Booking are not available! ")';
echo '</script>';
}
}
?>
<body>
<div id="wrapper">
<div id="header">
<ul id="mainnav">
<li><a href="dashboard.php">Home</a></li>
<li class="current"><a href="history.php">Booking</a></li>
<li><a href="routes.php">Routes</a></li>
<li><a href="contact.php">Contact Us</a></li>
<li><a href="search.php">Search</a></li>
<li><a href="logout.php">Logout</a></li>
</ul>
</div>
<div id="content">
<div id="gallerycontainer">
<table class="login">
<form action="history.php" method="post" align="center" >
<tr><td>Enter Bus Id </td><td><input type="text" class=" " name="id_no" placeholder="Number" required /> </td> </tr>
<tr><td> Date </td><td><input type="date" class=" " name="bdate" placeholder="Date" required /></td> </tr>
<tr><td>Enter name </td><td><input type="text" class=" " name="cname" placeholder="Name" required /> </td> </tr>
<tr><td>Number of person </td><td><input type="text" class=" " name="no" placeholder="Number of people" required /> </td> </tr>
<tr><td> Mobile number </td><td><input type="text" class=" " name="mob_no" placeholder="Mobile no" required /></td> </tr>
<tr><td>Starting point </td><td><select name="startP">
<option value="Select">Select</option>}
<option value="Akola">Akola</option>
<option value="Nagpur">Nagpur</option>
<option value="Pune">Pune</option>
<option value="Nanded">Nanded</option>
<option value="Mumbai">Mumbai</option>
<option value="Goa">Goa</option>
</select> </td> </tr>
<tr><td>Destination</td><td><select name="desP">
<option value="Select">Select</option>}
<option value="Akola">Akola</option>
<option value="Nagpur">Nagpur</option>
<option value="Pune">Pune</option>
<option value="Nanded">Nanded</option>
<option value="Mumbai">Mumbai</option>
<option value="Goa">Goa</option>
</select> </td> </tr>
<tr><td>Enter bus type</td><td><select name="type">
<option value="Select">Select</option>}
<option value="ac">AC</option>
<option value="nonac">NON AC</option>
</select> </td> </tr>
<tr><td>Payment</td></tr>
<tr><label><td><input type="radio" name="radio" value="On line"> Online </td></label></tr><tr><label><td><input type="radio" name="radio" value="Off line">Off line</td> <label></tr>
<tr><td><input type="submit" name="submit7" value="Confim" class="button"></td> </tr>
</p>
</form>
</table>
</div>
</div>
</body>
</html>