-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdatetrip.php
More file actions
42 lines (37 loc) · 865 Bytes
/
Copy pathupdatetrip.php
File metadata and controls
42 lines (37 loc) · 865 Bytes
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Bus Trips</title>
</head>
<body>
<?php
include 'displayimage.php';
include 'connectdb.php';
?>
<h1>Here are the bus trips updated:</h1>
<ol>
<?php
$newName = $_POST["newName"];
$newStart = $_POST["newStart"];
$newEnd = $_POST["newEnd"];
$newImage = $_POST["newImage"];
$trip= $_POST["pickbustrip"];
if ($newStart > $newEnd) {
die("invalid, enter a starting date less than end date");
}
$query = "UPDATE bustrip SET tripName ='" . $newName . "'," . "startDate ='" . $newStart .
"'," . "endDate ='" . $newEnd . "'," . "image ='" .'<img src="'. $newImage . "' WHERE busTripID ='" . $trip . "'";
$result=mysqli_query($connection,$query);
if (!$result) {
printf($query);
die("update failed");
}
echo ("successfully updated");
?>
</ol>
<?php
mysqli_close($connection);
?>
</body>
</html>