-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit_train.php
66 lines (59 loc) · 1.86 KB
/
edit_train.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
<?php
$id = $_GET['id'];
$conn = new mysqli("localhost", "csci601", "csci601", "csci601");
if ($conn->connect_error) {
die("Connection failed: ". $conn->connect_error);
}
$attrs = $conn->query("select name,capacity,speed from train where id=$id")->fetch_array();
$name = $attrs[0];
$capacity = $attrs[1];
$speed = $attrs[2];
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Book A Choooo Chooooo</title>
<style>
body {
font-family: "Courier New", monospace;
font-size: small;
}
.insert {
padding: 5px;
border-style: solid;
border-width: 1px;
margin-bottom: 5px;
}
.insert p {
font-weight: bold;
color: red;
}
.insert form {
margin-bottom: 5px;
}
.insert th {
color: red;
}
th, td {
text-align: center;
border-bottom: 1px solid #bbb;
}
td {
text-align: left;
}
</style>
</head>
<body>
<div class="insert">
<p>Edit Train</p>
<form method="POST" action="update_train.php">
<input type="hidden" name="train_id" value="<?php echo "$id"; ?>" />
<label>Name: <input type="text" name="train_name" value="<?php echo "$name"; ?>" /></label>
<label>Capacity: <input type="text" name="train_capacity" value="<?php echo "$capacity"; ?>" /></label>
<label>Speed: <input type="text" name="train_speed" value="<?php echo "$speed"; ?>" /></label>
<input type="submit" />
</form>
</div>
</body>
</html>