-
Notifications
You must be signed in to change notification settings - Fork 0
/
index1.php
203 lines (165 loc) · 4.97 KB
/
index1.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
<?php
include("header.php");
include ("connection.php");
?>
<br><br><br><br><br>
<!-- Booking Start -->
<form method="POST">
<div class="container-fluid booking mt-5 pb-5" style="min-height:450px;">
<div class="container pb-5">
<div class="bg-light shadow" style="padding: 30px;">
<div class="row align-items-center" style="min-height: 60px;">
<div class="col-md-10">
<div class="row">
<div class="col-md-6">
<div class="mb-4 mb-md-0">
<select class="custom-select px-4" style="height: 47px;" name="from" required>
<option value="">From</option>
<?php
$sel=mysqli_query($con,"select * from location");
while($row=mysqli_fetch_array($sel))
{
?>
<option value="<?php echo $row['id']; ?>"><?php echo $row['name']; ?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="col-md-6">
<div class="mb-4 mb-md-0">
<select class="custom-select px-4" style="height: 47px;" name="to" required>
<option value="">To</option>
<?php
$sel=mysqli_query($con,"select * from location");
while($row=mysqli_fetch_array($sel))
{
?>
<option value="<?php echo $row['id']; ?>"><?php echo $row['name']; ?></option>
<?php
}
?>
</select>
</div>
</div>
</div>
</div>
<div class="col-md-2">
<button class="btn btn-primary btn-block" type="submit" name="submit" style="height: 47px; margin-top: -2px;">Submit</button>
</div>
</form>
</div>
</div>
<h3>Travel Mode: Bus</h3>
<table class="table">
<tr>
<th>#</th>
<th>Name</th>
<th>Day</th>
<th>Time</th>
<th>Fare</th>
</tr>
<?php
if(isset($_POST['submit']))
{
$from=$_POST['from'];
$to=$_POST['to'];
//$sel="SELECT DISTINCT mode_transport FROM fare";
$sel="SELECT * FROM `fare` where (source='$from'OR destination='$to') and mode_transport='bus'";
//echo $sel;
$res=mysqli_query($con,$sel);
$i=1;
while($row=mysqli_fetch_array($res))
{
?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['day']; ?></td>
<td><?php echo $row['travel_time']; ?></td>
<td><?php echo $row['fare_rate']; ?></td>
<td></td>
</tr>
<?php
$i++;
}
}
?>
</table>
<h3>Travel Mode: Train</h3>
<table class="table">
<tr>
<th>#</th>
<th>Name</th>
<th>Day</th>
<th>Time</th>
<th>Fare</th>
</tr>
<?php
if(isset($_POST['submit']))
{
$from=$_POST['from'];
$to=$_POST['to'];
$sel1="SELECT * FROM `fare` where (source='$from' OR destination='$to') and mode_transport='train'";
//echo $sel1;
$res1=mysqli_query($con,$sel1);
$i=1;
while($row1=mysqli_fetch_array($res1))
{
?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $row1['name']; ?></td>
<td><?php echo $row1['day']; ?></td>
<td><?php echo $row1['travel_time']; ?></td>
<td><?php echo $row1['fare_rate']; ?></td>
<td></td>
</tr>
<?php
$i++;
}
}
?>
</table>
<h3>Travel Mode: Metro</h3>
<table class="table">
<tr>
<th>#</th>
<th>Name</th>
<th>Day</th>
<th>Time</th>
<th>Fare</th>
</tr>
<?php
if(isset($_POST['submit']))
{
$from=$_POST['from'];
$to=$_POST['to'];
$sel2="SELECT * FROM `fare` where (source='$from' OR destination='$to') and mode_transport='metro'";
//echo $sel2;
$res2=mysqli_query($con,$sel2);
$i=1;
while($row2=mysqli_fetch_array($res2))
{
?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $row2['name']; ?></td>
<td><?php echo $row2['day']; ?></td>
<td><?php echo $row2['travel_time']; ?></td>
<td><?php echo $row2['fare_rate']; ?></td>
<td></td>
</tr>
<?php
$i++;
}
}
?>
</table>
</div>
</div>
<!-- Booking End -->
<?php
include("footer.php");
?>