-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit_location.php
76 lines (66 loc) · 2.33 KB
/
edit_location.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
<?php
include_once("connection.php");
$sql = "SELECT * FROM Locations WHERE location_id = ?;";
$stmt = mysqli_stmt_init($connection);
mysqli_stmt_prepare($stmt, $sql);
mysqli_stmt_bind_param($stmt, "i", $_GET["id"]);
mysqli_stmt_execute($stmt);
$location_query = $stmt->get_result();
mysqli_stmt_close($stmt);
$location = mysqli_fetch_assoc($location_query);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Edit Location</title>
<style>
form {
max-width: 400px;
margin: 0 auto;
}
label {
display: block;
}
input, select {
width: 100%;
padding: 10px;
margin-bottom: 15px;
border-radius: 5px;
box-sizing: border-box;
}
button {
padding: 10px 20px;
background-color: blue;
color: white;
cursor: pointer;
border-radius: 5px;
}
button:hover {
background-color: blue;
}
h1.title{
text-align: center;
}
</style>
</head>
<body>
<h1 class="title">Edit Location</h1>
<form action="./database.php" method="post">
<input type="hidden" name="locationID" value="<?php echo $_GET["id"]; ?>">
<label for="locationName">Name:</label>
<input type="text" id="locationName" name="locationName" required value="<?php echo $location["name"]; ?>"><br>
<label for="locationDescription">Description:</label>
<input type="text" id="locationDescription" name="locationDescription" required value="<?php echo $location["description"]; ?>"> <br>
<label for="locationType">Location Type</label>
<select id="locationType" name="locationType" required>
<option value="Spawn" <?php echo ($location["type"] == "Spawn") ? "selected" : "";?>>Spawn</option>
<option value="Healing" <?php echo ($location["type"] == "Healing") ? "selected" : "";?>>Healing</option>
<option value="Enemy" <?php echo ($location["type"] == "Enemy") ? "selected" : "";?>>Enemy</option>
</select><br><br>
<button type="submit" name="updateLocation";">Update Location</button>
<button type="button" onclick="window.location.href='admin.php';">Cancel</button>
</form>
</body>
</html>