-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit_laundry.php
110 lines (97 loc) · 2.8 KB
/
edit_laundry.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css">
<title>Edit Laundry Data</title>
<style>
body {
background-image: url('Hostel/Hostel-3.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
font-family: 'Arial', sans-serif;
margin: 0;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
background-color: #f2f2f2;
}
.container {
background-color: #fff;
border-radius: 15px;
padding: 20px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.edit-section {
max-width: 600px;
}
.floor-row {
margin-bottom: 15px;
}
label {
display: inline-block;
width: 120px;
font-weight: bold;
}
select {
width: 150px;
padding: 5px;
}
input[type="submit"] {
margin-top: 15px;
padding: 10px;
background-color: #000066;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<div class="edit-section">
<h2>Edit Laundry Data</h2>
<form action="laundry_up.php" method="post">
<?php
$db = mysqli_connect("localhost", "root", "", "project");
if ($db->connect_error) {
die("Connection failed: " . $db->connect_error);
}
$daysOfWeek = [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday",
];
$sql = "SELECT * FROM laundry";
$result = $db->query($sql);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "<div class='floor-row'>";
echo "<label for='floor{$row["floor"]}'>{$row["floor"]}th Floor:</label>";
echo "<select name='day{$row["floor"]}' id='floor{$row["floor"]}'>";
foreach ($daysOfWeek as $day) {
$selected = $day == $row["day"] ? "selected" : "";
echo "<option value='$day' $selected>$day</option>";
}
echo "</select>";
echo "</div>";
}
} else {
echo "No data available";
}
$db->close();
?>
<input type="submit" value="Save Changes">
</form>
</div>
</div>
</body>
</html>