-
Notifications
You must be signed in to change notification settings - Fork 1
/
event_management.php
94 lines (87 loc) · 2.64 KB
/
event_management.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
<?php
$title = "Event Management";
include("lib/header.php");
?>
<!-- Form for adding an event -->
<h2>Add Event</h2>
<form action="add_event.php" method="post">
<!-- Input fields for event details -->
<label for="eventID">eventID:</label>
<input type="text" id="eventID" name="eventID" required>
<br>
<label for="userID">userID:</label>
<input type="text" id="userID" name="userID" required>
<br>
<label for="eventDate">Event Date:</label>
<input type="date" id="eventDate" name="eventDate" required>
<br>
<label for="eventTitle">Event Title:</label>
<input type="text" id="eventTitle" name="eventTitle" required>
<br>
<label for="eventDescription">Event Description:</label>
<input type="text" id="eventDescription" name="eventDescription" required>
<br>
<button type="submit">Add Event</button>
</form>
<!-- Form for updating an event -->
<h2>Update Event</h2>
<form action="update_event.php" method="post">
<!-- Input fields for event details -->
<label for="eventIdToUpdate">Event ID to Update:</label>
<input type="text" id="eventIdToUpdate" name="eventIdToUpdate" required>
<br>
<label for="newEventDate">New Event Date:</label>
<input type="date" id="newEventDate" name="newEventDate" required>
<br>
<label for="newEventTitle">New Event Title:</label>
<input type="text" id="newEventTitle" name="newEventTitle" required>
<br>
<label for="newEventDescription">New Event Description:</label>
<input type="text" id="newEventDescription" name="newEventDescription" required>
<br>
<button type="submit">Update Event</button>
</form>
<!-- Form for deleting an event -->
<h2>Delete Event</h2>
<form action="delete_event.php" method="post">
<label for="eventIdToDelete">Event ID to Delete:</label>
<input type="text" id="eventIdToDelete" name="eventIdToDelete" required>
<br>
<button type="submit">Delete Event</button>
</form>
<!-- Event Log -->
<h2>Event Log</h2>
<table border="1">
<tr>
<th>Event ID</th>
<th>User ID</th>
<th>Event Date</th>
<th>Event Title</th>
<th>Event Description</th>
</tr>
<?php
// Create connection
require_once('lib/db.php');
// Select data from Events table
$sql = "SELECT * FROM Events";
$result = $conn->query($sql);
// Output data of each row
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $row["EventID"] . "</td>";
echo "<td>" . $row["UserID"] . "</td>";
echo "<td>" . $row["EventDate"] . "</td>";
echo "<td>" . $row["EventTitle"] . "</td>";
echo "<td>" . $row["EventDescription"] . "</td>";
echo "</tr>";
}
} else {
echo "<tr><td colspan='5'>0 results</td></tr>";
}
$conn->close();
?>
</table>
<?php
include("lib/footer.php");
?>