Newer
Older
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
<?php
require('includes/config.php');
?>
<!DOCTYPE html>
<html>
<head>
<title>Make an order</title>
<link rel="stylesheet" type="text/css" href="css/orderojek.css">
<script src="js/order.js"></script>
</head>
<body>
<div class="contentBox">
<div class="mainHeader">
<div class="header1">
<div class="title"><span class="title green">PR</span>-<span class=" title red">OJEK</span></div>
<div class="subtitle">wush... wush... ngeeeeeenggg...</div>
</div>
<div class="header2">
<div class="username">Hi, <span class="username bold">pikachu!</span></div>
<div class="logout">Logout</div>
</div>
</div>
<div>
<div class="menu active">ORDER</div>
<div class="menu">HISTORY</div>
<div class="menu">MY PROFILE</div>
</div>
<h1>MAKE AN ORDER</h1>
<div id="box_aktif">
<div class="stepBox">
<div class="number">1</div>
<div class="step">Select Destination</div>
</div>
<div class="stepBox active">
<span class="number">2</span>
<div class="step">Select a Driver</div>
</div>
<div class="stepBox">
<span class="number">3</span>
<div class="step">Complete your order</div>
</div>
<div class="roundedBox preferred">
<span class="header3"><b>PREFERRED DRIVERS:</b></span>
<br><br>
<div class="header3 paragraph">
reiva5
committed
$con = mysqli_connect('127.0.0.1','root','','pr-ojek');
$prefer_driver = $_POST['preferredDriver'];
reiva5
committed
$query = "SELECT * FROM drivers NATURAL JOIN users WHERE name like '%".$prefer_driver."%' ORDER BY total_rating/total_passangers LIMIT 1";
$tmp = mysqli_query($con, $query);
$exist = $prefer_driver !== "" && mysqli_num_rows($tmp) == 1;
$res = mysqli_fetch_assoc($tmp);
if ($exist){
$image = '<img src="' . $res['image'] . '" class="gambar">';
echo $image.'<div class="header3 lain">' . $res['name'] . '</div>';
echo '<div class="header3 lain2"> ☆'.$res['total_rating']/($res['total_passangers'] > 0 ? $res['total_passangers'] : 1) . ' (' . $res['total_passangers'] . ' votes) </div><br>';
reiva5
committed
echo '<form action="completeorder.php" id="menuDua" name="menuDua" method="POST">';
echo '<div class="choosen">';
echo '<input type="submit" name="choosen" value="I CHOOSE YOU!">';
echo '<input type="hidden" name="ID" value="' . $res['ID'] . '">';
echo '<input type="hidden" name="pickingPoint" value="' . $_POST['pickingPoint'] . '">';
echo '<input type="hidden" name="destination" value="' . $_POST['destination'] . '">';
reiva5
committed
echo '</div>';
echo '</form>';
} else {
echo "NOTHING TO DISPLAY :(";
}
</div>
<div class="roundedBox others">
<div class="header3"><b>OTHER DRIVERS:</b></div>
<?php
$con = mysqli_connect('127.0.0.1','root','','pr-ojek');
$query = "SELECT * FROM drivers NATURAL JOIN users NATURAL JOIN driver_locations WHERE name NOT like '%".$prefer_driver."%' AND location = '" . $_POST['pickingPoint'] . "' ORDER BY total_rating/total_passangers";
$tmp = mysqli_query($con, $query);
$exist = $prefer_driver !== "" && mysqli_num_rows($tmp) > 0;
if ($exist){
while ($res = mysqli_fetch_assoc($tmp)){
$image = '<img src="' . $res['image'] . '" class="gambar">';
echo $image.'<div class="header3 lain">' . $res['name'] . '</div>';
echo '<div class="header3 lain2"> ☆'.$res['total_rating']/($res['total_passangers'] > 0 ? $res['total_passangers'] : 1) . ' (' . $res['total_passangers'] . ' votes) </div><br>';
echo '<form action="completeorder.php" id="menuDua" name="menuDua" method="POST">';
echo '<div class="choosen">';
echo '<input type="submit" name="choosen" value="I CHOOSE YOU!">';
echo '<input type="hidden" name="ID" value="' . $res['ID'] . '">';
echo '<input type="hidden" name="pickingPoint" value="' . $_POST['pickingPoint'] . '">';
echo '<input type="hidden" name="destination" value="' . $_POST['destination'] . '">';
echo '</div>';
echo '</form>';
echo '<br><br><br>';
}
} else {
echo "NOTHING TO DISPLAY :(";
}
?>
</div>
</div>
</body>
</html>