-
Notifications
You must be signed in to change notification settings - Fork 0
/
eventsView.php
75 lines (65 loc) · 2.53 KB
/
eventsView.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
<?php
include("includes/db.inc.php");
if (!isset($_SESSION["userID"])){
header("location:index.php");
}
$id = $_GET["ID"];
$sql = "SELECT * FROM events WHERE eventsId=" . $id; //For name of event
$result = mysqli_query($conn, $sql);
$event = mysqli_fetch_assoc($result);
$sql = "SELECT * FROM signups LEFT JOIN users ON signups.userId = users.userID WHERE Signups.eventId = " . $id;
$result = mysqli_query($conn, $sql);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Signups</title>
</head>
<body>
<header>
<nav>
<ul class="navLinks">
<li><a href="">Events</a></li>
<li><a href="users.php">Users</a></li>
</ul>
</nav>
<a href="includes/logout.inc.php"><button>Sign off</button></a>
</header>
<div>
<h1 style="text-align:center; color:white; padding-top:0.5em"><?= $event["eventName"] ?></h1>
<h2 style="text-align:center; color:white;">Signups</h2>
<div class = "table" >
<table class="content-table">
<thead>
<tr>
<th>Name</th>
<th>Age</th>
<th>Gender</th>
<th>Country</th>
<th></th>
</tr>
</thead>
<tbody>
<?php while($signups = mysqli_fetch_assoc($result)) {
$user = $signups["userID"]?>
<tr>
<td><?= $signups["userName"] ?></td>
<td><?= $signups["userAge"] ?></td>
<td><?= $signups["userGender"] ?></td>
<td><?= $signups["userCountry"] ?></td>
<td><button onclick="window.location.href = 'includes/deleteSignup.inc.php?ID=<?= $id ?>&user=<?= $user ?>';" style="background-color:red">Delete</button></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div style="display:flex; justify-content:center">
<button onclick="window.location.href = 'signup.add.php?ID=<?= $id?>';">Add signup</button>
</div>
</div>
</body>
</html>