forked from tasminoni/CSE370-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
postrequest.php
83 lines (71 loc) · 2.53 KB
/
postrequest.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
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "db";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM addproperty WHERE status = 'pending'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<style>
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
}
th, td {
padding: 12px 15px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
background-color: #f2f2f2;
}
td select {
padding: 8px 10px;
border: 1px solid #ccc;
border-radius: 4px;
background-color: #f8f8f8;
}
td input[type='submit'] {
padding: 8px 15px;
border: none;
border-radius: 4px;
background-color: #4CAF50;
color: white;
cursor: pointer;
}
td input[type='submit']:hover {
background-color: #45a049;
}
</style>";
echo "<a href='admin.php' style='position: absolute; top: 10px; left: 10px; padding: 10px; background-color: #4CAF50; color: white; text-decoration: none; border-radius: 4px;'>Home</a>";
echo "<table>";
echo "<tr><th>Name</th><th>Flat ID</th><th>Post Status</th><th>Action</th></tr>";
while($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $row["name"] . "</td>";
echo "<td>" . $row["Flatid"] . "</td>";
echo "<td>" . $row["status"] . "</td>";
echo "<td>";
echo "<form action='updatestatus2.php' method='post'>";
echo "<input type='hidden' name='Flatid' value='" . $row["Flatid"] . "'>";
echo "<select name='action'>";
echo "<option value='approved'>Approve</option>";
echo "<option value='deny'>Deny</option>";
echo "</select>";
echo "<input type='submit' value='Submit'>";
echo "</form>";
echo "</td>";
echo "</tr>";
}
echo "</table>";
} else {
echo "<a href='admin.php' style='position: absolute; top: 10px; left: 10px; padding: 10px; background-color: #4CAF50; color: white; text-decoration: none; border-radius: 4px;'>Home</a><br><br><br>";
echo "0 results";
}
$conn->close();
?>