-
Notifications
You must be signed in to change notification settings - Fork 0
/
showingAttendeeList.php
129 lines (108 loc) · 3.08 KB
/
showingAttendeeList.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
//connect to database
require_once('database.php');
// Get category ID
$showingID = filter_input(INPUT_POST, 'showingID');
//get all units
$query = 'SELECT * FROM units
ORDER BY unitID';
$statement1 = $db->prepare($query);
$statement1->execute();
$units = $statement1->fetchAll();
$statement1->closeCursor();
//get the showing
$query = 'SELECT * FROM showings
WHERE showingID = :showingID';
$statement3 = $db->prepare($query);
$statement3->bindValue(':showingID', $showingID);
$statement3->execute();
$showing = $statement3->fetch();
$statement3->closeCursor();
//get unit information
$queryUnit = 'SELECT * FROM units
WHERE unitID = :unitID';
$statement2 = $db->prepare($queryUnit);
$statement2->bindValue(':unitID', $showing['unitID']);
$statement2->execute();
$selectedUnit = $statement2->fetch();
$statement2->closeCursor();
//get all attendees
$query = 'SELECT * FROM showingattendees
WHERE showingID = :showingID';
$statement4 = $db->prepare($query);
$statement4->bindValue(':showingID', $showingID);
$statement4->execute();
$showingAttendees = $statement4->fetchAll();
$statement4->closeCursor();
?>
<!doctype html>
<html>
<head>
<title>Title</title>
<link rel="stylesheet" type="text/css" href="css/main.css"/>
</head>
<body>
<div class="wrapper">
<nav>
<?php include_once('navigation.php')?>
</nav>
<header>
<div class="hero">
</div>
</header>
<main>
<div class="rightNavigation">
<form action="showingList.php.?unitID=<?php echo $unit['unitID']; ?>">
<caption>Select a Unit</caption><br>
<select name="unitID">
<?php foreach ($units as $unit) : ?>
<option value="<?php echo $unit['unitID']; ?>"><?php echo $unit['address']; ?></option>
<?php endforeach; ?>
</select>
<br>
<input type="submit">
</form>
<form action="addShowing.php" method="post">
<table>
<caption>Add a new Showing</caption>
<tr>
<td>Date</td>
<td><input type="date" name="date"></td>
</tr>
<tr>
<td>Time</td>
<td><input type="time" name="time"></td>
</tr>
</table>
<input type="hidden" name="unitID" value="<?php echo $unitID; ?>">
<td><input type="submit" value="Add Showing"></td>
</form>
</div>
<h1><?php echo $selectedUnit['address'] ?></h1>
<h2>Date: <?php echo $showing['date'] ?></h2>
<h2>Time: <?php echo $showing['time'] ?></h2>
<table>
<caption>Attendees</caption>
<tr>
<th>Name</th>
<th>Phone Number</th>
<th>Email</th>
</tr>
<!-- display a list of units -->
<?php foreach ($showingAttendees as $attendee ) : ?>
<tr>
<td class="middle"><?php echo $attendee['firstName']." ".$attendee['middleInitial']." ".$attendee['lastName'] ?></td>
<td class="middle"><?php echo $attendee['phoneNumber'] ?></td>
<td class="middle"><?php echo $attendee['email'] ?></td>
</tr>
<?php endforeach; ?>
</table>
</main>
<!-- <div style="clear: both;"> </div> -->
</main>
<footer>
<?php include_once('footer.php')?>
</footer>
</div>
</body>
</html>