Skip to content

Commit 4a7f368

Browse files
committed
fixed user request and announcement UI and some function #8
1 parent a2d2390 commit 4a7f368

4 files changed

Lines changed: 114 additions & 44 deletions

File tree

pages/Admin/announcement/editForm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<head>
3939
<meta charset="UTF-8">
4040
<meta name="viewport" content="width=device-width, initial-scale=1.0">
41-
<title>Document</title>
41+
<title>Add Form</title>
4242
</head>
4343
<body>
4444
<?php include '../admin.php'; ?>

pages/Admin/announcement/news.php

Lines changed: 50 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
<head>
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6-
<title>Document</title>
6+
<title>Announcements</title>
77
<link rel="stylesheet" href="../../../assets/css/news.css" />
88
</head>
99
<body>
1010
<?php include '../admin.php'; ?>
11-
<!-- Main Content -->
11+
1212
<div class="main-content-3">
1313
<h3>Announcements</h3>
1414

@@ -20,52 +20,64 @@
2020
<th>Date Posted</th>
2121
<th>Actions</th>
2222
</tr>
23+
</thead>
24+
<tbody>
25+
2326
<?php
24-
$servername = "localhost";
25-
$username = "root";
26-
$password = "";
27-
$dbname = "saklaw";
27+
$servername = "localhost";
28+
$username = "root";
29+
$password = "";
30+
$dbname = "saklaw";
2831

29-
$conn = mysqli_connect($servername, $username, $password, $dbname);
32+
$conn = mysqli_connect($servername, $username, $password, $dbname);
3033

31-
if (!$conn) {
32-
die("Connection failed: " . mysqli_connect_error());
33-
}
34+
if (!$conn) {
35+
die("Connection failed: " . mysqli_connect_error());
36+
}
3437

35-
$sql = "SELECT * FROM newupdate";
36-
$result = mysqli_query($conn, $sql);
38+
$sql = "SELECT * FROM newupdate";
39+
$result = mysqli_query($conn, $sql);
3740

38-
if (mysqli_num_rows($result) > 0) {
39-
while ($rows = mysqli_fetch_assoc($result)) {
40-
echo "<tr>";
41-
echo "<td>" . $rows["title"] . "</td>";
42-
echo "<td>" . $rows["Content"] . "</td>";
43-
echo "<td>" . $rows["date"] . "</td>";
41+
if (mysqli_num_rows($result) > 0) {
4442

45-
echo "<td>
46-
<form method='POST' action='edit.php'>
47-
<input type='hidden' name='updateID' value='" . $rows['updateID'] . "'>
48-
<input type='submit' value=' Edit ' class='edit-btn'>
49-
</form>
50-
<br>
51-
<form method='POST' action='delete.php'>
52-
<input type='hidden' name='updateID' value='" . $rows['updateID'] . "'>
53-
<input type='hidden' name='newupdate' value='DELETE'>
54-
<input type='submit' value=' Delete ' class='delete-btn'>
55-
</td> ";
56-
43+
while ($rows = mysqli_fetch_assoc($result)) {
44+
echo "<tr>";
45+
echo "<td>" . htmlspecialchars($rows["title"]) . "</td>";
46+
echo "<td>" . htmlspecialchars($rows["Content"]) . "</td>";
47+
echo "<td>" . htmlspecialchars($rows["date"]) . "</td>";
5748

58-
echo "</tr>";
59-
}
60-
} else {
61-
echo "<tr><td colspan='6' align='center'>No Result Found!!</td></tr>";
49+
echo "<td>
50+
<form method='POST' action='edit.php'>
51+
<input type='hidden' name='updateID' value='" . $rows['updateID'] . "'>
52+
<input type='submit' value='Edit' class='edit-btn'>
53+
</form>
54+
<br>
55+
<form method='POST' action='delete.php'>
56+
<input type='hidden' name='updateID' value='" . $rows['updateID'] . "'>
57+
<input type='hidden' name='newupdate' value='DELETE'>
58+
<input type='submit' value='Delete' class='delete-btn'>
59+
</form>
60+
</td>";
61+
echo "</tr>";
6262
}
6363

64-
mysqli_close($conn);
65-
?>
64+
} else {
65+
echo "<tr><td colspan='4' align='center'>No Result Found</td></tr>";
6666

67+
echo "<tr>
68+
<td colspan='4' align='center'>
69+
<form method='POST' action='edit.php'>
70+
<input type='submit' value='Add Announcement' class='edit-btn'>
71+
</form>
72+
</td>
73+
</tr>";
74+
}
75+
76+
mysqli_close($conn);
77+
?>
78+
79+
</tbody>
6780
</table>
6881
</div>
69-
</div>
7082
</body>
71-
</html>
83+
</html>

pages/Admin/dashboard/dash.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
<head>
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6-
<title>Document</title>
6+
<title>Dashboard</title>
77
</head>
88
<body>
99
<?php include '../admin.php'; ?>
10-
<!-- Main Content -->
10+
1111
<div class="main-content">
1212
<h3>Recent Requests</h3>
1313

@@ -33,8 +33,6 @@
3333
if (!$conn) {
3434
die("Connection failed: " . mysqli_connect_error());
3535
}
36-
37-
// ✅ Adjust query & column names to match your table
3836
$sql = "SELECT Fullname, RequestType, Date, Status FROM dashboard";
3937
$result = mysqli_query($conn, $sql);
4038

pages/Admin/userRequest/userReq.php

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,69 @@
33
<head>
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6-
<title>Document</title>
6+
<title>User Request</title>
77
</head>
88
<body>
99
<?php include '../admin.php'; ?>
10+
11+
<div class="main-content">
12+
<h3>Recent Requests</h3>
13+
14+
<table class="request-table">
15+
<thead>
16+
<tr>
17+
<th>Full Name</th>
18+
<th>Request Type</th>
19+
<th>Date</th>
20+
<th>Status</th>
21+
</tr>
22+
</thead>
23+
<tbody>
24+
<?php
25+
//Database connection
26+
$servername = "localhost";
27+
$username = "root";
28+
$password = "";
29+
$dbname = "saklaw";
30+
31+
$conn = mysqli_connect($servername, $username, $password, $dbname);
32+
33+
if (!$conn) {
34+
die("Connection failed: " . mysqli_connect_error());
35+
}
36+
37+
$sql = "SELECT dashId, Fullname, RequestType, Date, Status FROM dashboard";
38+
$result = mysqli_query($conn, $sql);
39+
40+
if (mysqli_num_rows($result) > 0) {
41+
while ($rows = mysqli_fetch_assoc($result)) {
42+
echo "<tr>";
43+
echo "<td>" . htmlspecialchars($rows['Fullname']) . "</td>";
44+
echo "<td>" . htmlspecialchars($rows['RequestType']) . "</td>";
45+
echo "<td>" . htmlspecialchars($rows['Date']) . "</td>";
46+
echo "<td>
47+
<form method='POST'>
48+
<input type='hidden' name='dashId' value='" . $rows['dashId'] . "'>
49+
<input type='submit' value='Approve' class='edit-btn'>
50+
</form>
51+
<br>
52+
<form method='POST'>
53+
<input type='hidden' name='dashId' value='" . $rows['dashId'] . "'>
54+
<input type='hidden' name='newupdate' value='DELETE'>
55+
<input type='submit' value='Decline' class='delete-btn'>
56+
</form>
57+
</td>";
58+
echo "</tr>";
59+
}
60+
} else {
61+
echo "<tr><td colspan='4' align='center'>No Result Found</td></tr>";
62+
}
63+
64+
mysqli_close($conn);
65+
?>
66+
</tbody>
67+
</table>
68+
</div>
69+
</div>
1070
</body>
1171
</html>

0 commit comments

Comments
 (0)