-
Notifications
You must be signed in to change notification settings - Fork 0
/
deleteSwimmerFamily.php
98 lines (91 loc) · 2.47 KB
/
deleteSwimmerFamily.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
<?php
session_start();
include('header.php');
?>
<html>
<body>
<?php
include('siteNavigator.php');
?>
<!--
last modified by patrick
fixed so you could actually see the swimmers in the family on dropdown
select to bring up info
and delete with button
-->
<!-- Page info goes below-->
<h1>Remove Swimmer</h1>
<h2>Here, you can select a swimmer to remove from your family.</h2>
<!--
<select>
<option value="volvo">Swimmer Name</option>
</select> -->
<form action = 'deleteSwimmerFamily.php' method = 'post'>
<?php
$famID = $_SESSION['familyID'];
$query = "SELECT * FROM swimmers WHERE familyID = '$famID';";
$result = mysqli_query($db, $query);
echo "<h4>Select Swimmer</h4>";
echo "<select name = 'option'>";
while($row = mysqli_fetch_array($result)){
$id = $row['swimmerID'];
$first = $row['swimmerFirstName'];
$middle = $row['swimmerMiddleInitial'];
echo "<option value = '$id'>$first $middle</option>";
}
?>
</select>
<input type = 'submit' value = 'view'/>
</form>
<?php
$option = $_POST['option'];
if ($option != null){
$query = "SELECT * FROM swimmers WHERE swimmerID = $option;";
$result = mysqli_query($db, $query);
while ($row = mysqli_fetch_array($result)){
$first = $row['swimmerFirstName'];
$middle = $row['swimmerMiddleInitial'];
$last = $row['swimmerLastName'];
$bday = $row['birthday'];
$group = $row['swimGroup'];
echo "
<form action = deleteSwimmerFamilyController.php method ='post'>
<input type = hidden value = $option name = 'swimmerID'>
<table border='0'>
<tr>
<td colspan='2' style='font-weight:bold' align='center'><h3>Swimmer Information</h3></td>
</tr>
<tr>
<td>First Name </td>
<td><input type = 'text' name = 'swimmerFirstName' disabled='disabled' value = '$first'/></td>
</tr>
<tr>
<td>Middle Initial </td>
<td><input type = 'text' name = 'swimmerMiddleInitial' disabled='disabled' value = '$middle'/></td>
</tr>
<tr>
<td>Last Name </td>
<td><input type = 'text' name = 'swimmerLastName' disabled='disabled' value = '$last'/></td>
</tr>
<tr>
<td>Birthday </td>
<td><input type = 'text' name = 'birthday' disabled='disabled' value = '$bday'/></td>
</tr>
<tr>
<td>Swim Group</td>
<td><input type = 'text' name = 'swimGroup' disabled='disabled' value = '$group'/></td>
</tr>
<tr>
<td><input type = 'submit' value = 'Remove Swimmer' /></td>
</tr>
</table>
</form>";
}
}
?>
</div> <!-- Page info goes above-->
<?php
include('footer.php');
?>
</body>
</html>