-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadmin_edit_admin_form.php
More file actions
282 lines (234 loc) · 12.4 KB
/
admin_edit_admin_form.php
File metadata and controls
282 lines (234 loc) · 12.4 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
<!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, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Edit User Admin Information</title>
<?php include("components/header.php"); ?>
<?php include("database.php"); ?>
<?php include("admin_validation.php") ?>
</head>
<body id="page-top">
<?php
$id = "";
$enrollmentStatus = "";
$gradeAccepted = "";
$yearAccepted = "";
$grantStatus = "";
$health = "";
$disability = "";
$ell = "";
$additionalInfo = "";
$error;
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$id = $_POST['user'];
}
$checkUserSql = "SELECT * FROM USERS WHERE id=" . $id ;
$checkUserResult = $conn->query($checkUserSql);
//var_dump($checkUserResult);
$sql = "SELECT * FROM ADMIN_USER_INFO WHERE id=" . $id ;
//echo $sql;
$result = $conn->query($sql);
//var_dump($result);
if($result && mysqli_num_rows($result) > 0){
$row = $result->fetch_assoc();
//var_dump($row);
if (!empty($row["Year_Accepted"])) {
$yearAccepted = $row["Year_Accepted"];
}
if (!empty($row["Grade_Accepted"])) {
$gradeAccepted = $row["Grade_Accepted"];
}
if (!empty($row["Enrollment_Status"])) {
$enrollmentStatus = $row["Enrollment_Status"];
}
if (!empty($row["Grant_Status"])) {
$grantStatus = $row["Grant_Status"];
}
if (!empty($row["Disability"])) {
$disability = $row["Disability"];
}
if (!empty($row["Health"])) {
$health = $row["Health"];
}
if (!empty($row["ELL"])) {
$ell = $row["ELL"];
}
if (!empty($row["Additional_Info"])) {
$additionalInfo = $row["Additional_Info"];
}
$error = "";
} else if ($_SERVER["REQUEST_METHOD"] == "POST") {
if(!$checkUserResult || mysqli_num_rows($checkUserResult) <= 0){
$error = "User not found";
}
}
?>
<?php include("components/navbar.php"); ?>
<div id="wrapper">
<?php include("components/sidebar.php"); ?>
<div id="content-wrapper">
<div class="container-fluid">
<h3>Edit Admin Info</h3>
<?php
if(!empty($error)){
echo "</br>";
echo "<label style='color: red;'>$error</label>";
}
?>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST" && empty($error)) {
echo "<div>";
echo "</br>";
} else {
echo "<div style='display: none;'>";
}
?>
<form action='insert_admin_info.php' method='post'>
<input type="hidden" name="user" class="form-control" required value=<?php echo $id ?> ]>
<!-- Year Accepted -->
<div class="form-group">
<div class="form-row">
<div class="col-md-2">
<h5>Year Accepted</h5>
</div>
<div class="col-md-3">
<select class="form-control" id="yearAccepted" required="required" name="yearAccepted">
<option value="" disabled selected></option>
<option value="2019" <?php if($yearAccepted == '2019') echo 'selected'; ?> >2019</option>
<option value="2020" <?php if($yearAccepted == '2020') echo 'selected'; ?> >2020</option>
<option value="2021" <?php if($yearAccepted == '2021') echo 'selected'; ?> >2021</option>
<option value="2022" <?php if($yearAccepted == '2022') echo 'selected'; ?> >2022</option>
<option value="2023" <?php if($yearAccepted == '2023') echo 'selected'; ?> >2023</option>
<option value="2024" <?php if($yearAccepted == '2024') echo 'selected'; ?> >2024</option>
<option value="2025" <?php if($yearAccepted == '2025') echo 'selected'; ?> >2025</option>
<option value="2026" <?php if($yearAccepted == '2026') echo 'selected'; ?> >2026</option>
<option value="2027" <?php if($yearAccepted == '2027') echo 'selected'; ?> >2027</option>
<option value="2028" <?php if($yearAccepted == '2028') echo 'selected'; ?> >2028</option>
</select>
</div>
</div>
</div>
<!-- Grade Accepted -->
<div class="form-group">
<div class="form-row">
<div class="col-md-2">
<h5>Grade Level When Accepted</h5>
</div>
<div class="col-md-3">
<select class="form-control" id="gradeAccepted" required="required" name="gradeAccepted">
<option value="" disabled selected></option>
<option value="4" <?php if($gradeAccepted == '4') echo 'selected'; ?> >4</option>
<option value="5" <?php if($gradeAccepted == '5') echo 'selected'; ?> >5</option>
<option value="6" <?php if($gradeAccepted == '6') echo 'selected'; ?> >6</option>
<option value="7" <?php if($gradeAccepted == '7') echo 'selected'; ?> >7</option>
<option value="8" <?php if($gradeAccepted == '8') echo 'selected'; ?> >8</option>
<option value="9" <?php if($gradeAccepted == '9') echo 'selected'; ?> >9</option>
<option value="10" <?php if($gradeAccepted == '10') echo 'selected'; ?> >10</option>
<option value="11" <?php if($gradeAccepted == '11') echo 'selected'; ?> >11</option>
<option value="12" <?php if($gradeAccepted == '12') echo 'selected'; ?> >12</option>
</select>
</div>
</div>
</div>
<!-- Enrollment Status -->
<div class="form-group">
<div class="form-row">
<div class="col-md-2">
<h5>Enrollment Status</h5>
</div>
<div class="col-md-3">
<select class="form-control" id="enrollmentStatus" required="required" name="enrollmentStatus">
<option value="" disabled selected></option>
<option value="Active" <?php if($enrollmentStatus == 'Active') echo 'selected'; ?> >Active</option>
<option value="Not Interested" <?php if($enrollmentStatus == 'Not Interested') echo 'selected'; ?> >Not Interested</option>
<option value="Moved Away" <?php if($enrollmentStatus == 'Moved Away') echo 'selected'; ?> >Moved Away</option>
<option value="Graduated" <?php if($enrollmentStatus == 'Graduated') echo 'selected'; ?> >Graduated</option>
</select>
</div>
</div>
</div>
<!-- Grant Funded -->
<div class="form-group">
<h5>Is this student grant funded?</h5>
<input type="radio" id="grantYes" name="grant" value="true" onclick="javascript:grantForm();" required="required" <?php echo !empty($grantStatus)?'checked':'' ?>> Yes<br>
<input type="radio" id="grantNo" name="grant" value="false" onclick="javascript:grantForm();" required="required" <?php echo !empty($grantStatus)?'':'checked' ?>> No<br>
</div>
<!-- Grant Name -->
<div id="grant" class="form-group" <?php if(empty($grantStatus)) echo 'style="display:none"'?> >
<div class="form-row">
<div class="col-md-2">
<h5>Grant Name</h5>
</div>
<div class="col-md-3">
<input type="text" id="grantName" name="grantName" class="form-control" <?php echo !empty($grantStatus)?'required':'' ?> value=<?php echo $grantStatus ?> >
</div>
</div>
</div>
<!-- Disability -->
<div class="form-group">
<div class="form-row">
<div class="col-md-2">
<h5>Disability Information</h5>
</div>
<div class="col-md-3">
<input type="text" name="disability" class="form-control" required="required" value=<?php echo $disability ?> >
</div>
</div>
</div>
<!-- Health -->
<div class="form-group">
<div class="form-row">
<div class="col-md-2">
<h5>Health Information</h5>
</div>
<div class="col-md-3">
<input type="text" name="health" class="form-control" required="required" value=<?php echo $health ?> >
</div>
</div>
</div>
<!-- ELL -->
<div class="form-group">
<h5>Is this student English Language Learner?</h5>
<input type="radio" name="ell" value="true" required="required" <?php echo $ell?'checked':'' ?>> Yes<br>
<input type="radio" name="ell" value="false" required="required" <?php echo $ell?'':'checked' ?>> No<br>
</div>
<!-- Additional Information -->
<div class="form-group">
<div class="form-row">
<div class="col-md-2">
<h5>Additional Information</h5>
</div>
<div class="col-md-3">
<input type="text" name="additionalInfo" class="form-control" required="required" value=<?php echo $additionalInfo ?> >
</div>
</div>
</div>
<input class='btn btn-primary btn-block col-md-3' type='submit' name='submit' value='Submit'>
</form>
</div>
</div>
<!-- /.container-fluid -->
<?php include("components/footer.php"); ?>
</div>
<!-- /.content-wrapper -->
</div>
<!-- /#wrapper -->
<?php include("components/javascript.php"); ?>
<script type="text/javascript">
function grantForm() {
if (document.getElementById('grantYes').checked) {
document.getElementById('grant').style.display = 'block';
document.getElementById('grantName').required = 'required';
}
else {
document.getElementById('grant').style.display = 'none';
document.getElementById('grantName').required = '';
}
}
</script>
</body>
</html>