-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodelView.php
More file actions
73 lines (60 loc) · 2.07 KB
/
Copy pathmodelView.php
File metadata and controls
73 lines (60 loc) · 2.07 KB
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
<?php
//echo $_GET["reqId"];
include "header.php";
function getBids(){
$bids = array();
//$id = $_SESSION['userId'];
$reqId = $_GET["reqId"];
$query = mysql_query("SELECT `driver_id`,`name`,`request_id`,`bid` FROM driverbid NATURAL JOIN driver WHERE request_id = $reqId");
while($row = mysql_fetch_array($query)){ // display all rows from query
$bidRow = array();
$bidRow[0] = $row['name'];
$bidRow[1] = $row['bid'];
$bidRow[2] = $row['driver_id'];
$bids[]= $bidRow;
}
return $bids;
}
?>
<html>
<head>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<table class="table table-striped">
<th>Driver Name</th>
<th>Bid</th>
<?php
$hireBids = getBids();
foreach ($hireBids as $bid) {
?>
<tr>
<td><?php echo $bid[0] ?></td>
<td><?php echo $bid[1] ?></td>
<td>
<button type="button" value="<?php echo $bid[2] ?>" class="btn-success">Accept Ride</button>
</td>
</tr>
<?php
}
?>
</table>
<script>
$(document).ready(function(){
$('.btn-success').click(function(){
var clickBtnValue = $(this).val();
var ajaxurl = 'ajax.php',
data = {
'driverId': clickBtnValue
};
$.post(ajaxurl, data, function (response) {
alert("You have suuccessfully booked a taxi\nDriver's Contact No : " + response);
window.top.location.assign("seeBids.php");
});
});
});
</script>
</body>
</html>