-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditgroup.php
82 lines (73 loc) · 2.58 KB
/
editgroup.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
<?PHP
include "dbconnect.php";
$sql = "SELECT * from coaches";
$result = $conn->query($sql);
$coaches = $result->fetch_all(MYSQLI_ASSOC);
$sql = "select * from groups where group_id = ?";
$group_id = $_REQUEST["group_id"];
$stmt = $conn->prepare($sql);
$stmt->bind_param("i", $group_id);
$stmt->execute();
$result = $stmt->get_result();
if($result->num_rows > 0) {
$row = $result->fetch_assoc();
}
?>
<form action="upgroup.php">
<label for="group_name">Group Name:</label></br>
<input type="text" id="group_name" name="group_name" value="<?php echo $row["group_name"];?>"></br>
<label for="num_swimmers">Number of Swimmers:</label></br>
<input type="text" id="num_swimmers" name="num_swimmers" value="<?php echo $row["num_swimmers"];?>"></br>
<label for="coach_id">Coach:</label></br>
<select id="coach_id" name="coach_id" >
<?php
for($i=0; $i< count($coaches); $i++)
{
echo '<option value = "' . $coaches[$i]["coach_id"];
if($coaches[$i]["fname"] == $row["coach"])
echo '" selected>';
else
echo '">';
echo $coaches[$i]["fname"] . "</option>";
}
?>
</select> </br>
<label for="assistant_1">Assistant 1:</label></br>
<select id="assistant_1" name="assistant_1" >
<?php
for($i=0; $i< count($coaches); $i++)
{
echo '<option value = "' . $coaches[$i]["fname"];
if($coaches[$i]["fname"] == $row["assistant_1"])
echo '" selected>';
else
echo '">';
echo $coaches[$i]["fname"] . "</option>";
}
echo '<option value = NULL>None</option>';
?>
</select> </br>
<label for="assistant_2">Assistant 2:</label></br>
<select id="assistant_2" name="assistant_2" >
<?php
for($i=0; $i< count($coaches); $i++)
{
echo '<option value = "' . $coaches[$i]["fname"];
if($coaches[$i]["fname"] == $row["assistant_2"])
echo '" selected>';
else
echo '">';
echo $coaches[$i]["fname"] . "</option>";
}
echo '<option value = NULL>None</option>';
?>
</select> </br>
<label for="age_range">Age Range:</label></br>
<input type="text" id="age_range" name="age_range" value="<?php echo $row["age_range"];?>"></br>
<input type="hidden" id="group_id" name="group_id" value="<?php echo $row["group_id"];?>"></br>
<input type="submit" value="Submit">
</form>
<?php
include "swimmers.php";
$conn->close();
?>