-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin_edit_s.php
More file actions
129 lines (103 loc) · 3.88 KB
/
admin_edit_s.php
File metadata and controls
129 lines (103 loc) · 3.88 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
<?php
require_once("models/config.php");
if (!securePage($_SERVER['PHP_SELF'])){die();}
require_once("models/header.php");
$stid = $_GET['stid'];
if (isset($_POST['st_name']) and isset($_POST['day']) and isset($_POST['month']) and isset($_POST['year']) and isset($_POST['st_gender']) and isset($_POST['st_nation'])) {
$st_name = trim($_POST['st_name']);
$day = trim($_POST['day']);
$month = trim($_POST['month']);
$year = trim($_POST['year']);
$st_dob = ''.$year.'-'.$month.'-'.$day.'';
$st_gender = trim($_POST['st_gender']);
$st_nation = trim($_POST['st_nation']);
$st_disability = trim($_POST['st_disability']);
$addstudent = $mysqli->prepare("UPDATE `bullytrack`.`student_particular` SET `student_name`='$st_name', `student_dob`='$st_dob', `student_gender`='$st_gender', `student_nationality`='$st_nation', `student_disability`='$st_disability' WHERE `student_id`='$stid';");
$addstudent->execute();
$addstudent->close();
$successes[] = lang("STUDENT_ADDED");
}
$getstudent = $mysqli->prepare("SELECT * from student_particular where student_id = '$stid'");
$getstudent->execute();
$getstudent->bind_result($id, $name, $dob, $gender, $nationality, $disability);
while ($getstudent->fetch()) {
$student = array('id' => $id, 'name' => $name, 'dob' => $dob, 'gender' => $gender, 'nationality' => $nationality, 'disability' => $disability);
}
$getstudent->close();
$d = $student['dob'];
$d = new DateTime($d);
$d = $d->format('d');
$m = $student['dob'];
$m = new DateTime($m);
$m = $m->format('m');
$y = $student['dob'];
$y = new DateTime($y);
$y = $y->format('Y');
echo "
</div>
<div id='main' class='col-md-10'><h2>Edit student:</h2>";
echo resultBlock($errors,$successes);
echo "<form class='form-horizontal' action='".$_SERVER['PHP_SELF']."?stid=$stid' method='post'>
<fieldset>
<!-- Text input-->
<div class='form-group'>
<label class='col-md-2 control-label' for='st_name'>Name:</label>
<div class='col-md-4'>
<input id='st_name' name='st_name' value='".$student['name']."' class='form-control input-md' required='' type='text'>
</div>
</div>
<!-- Text input-->
<div class='form-group'>
<label class='col-md-2 control-label' for='st_dob'>Date of birth:</label>
<div class='col-md-1'>
<input id='st_dob' name='day' value='$d' class='form-control input-md' required='' type='text'>
</div>
<div class='col-md-1'>
<input id='st_dob' name='month' value='$m' class='form-control input-md' required='' type='text'>
</div>
<div class='col-md-2'>
<input id='st_dob' name='year' value='$y' class='form-control input-md' required='' type='text'>
</div>
</div>
<!-- Select Basic -->
<div class='form-group'>
<label class='col-md-2 control-label' for='st_gender'>Gender:</label>
<div class='col-md-4'>
<select id='st_gender' name='st_gender' class='form-control'>
<option value=''>- select gender -</option>
<option value='Male'>Male</option>
<option value='Female'>Female</option>
</select>
</div>
</div>
<!-- Text input-->
<div class='form-group'>
<label class='col-md-2 control-label' for='st_nation'>Nationality:</label>
<div class='col-md-4'>
<input id='st_nation' name='st_nation' value='".$student['nationality']."' class='form-control input-md' required='' type='text'>
</div>
</div>
<!-- Text input-->
<div class='form-group'>
<label class='col-md-2 control-label' for='st_disability'>Disabilities:</label>
<div class='col-md-4'>
<input id='st_disability' name='st_disability' value='".$student['disability']."' class='form-control input-md' type='text'>
</div>
</div>
<!-- Button -->
<div class='form-group'>
<label class='col-md-2 control-label' for='submit'></label>
<div class='col-md-4'>
<button id='submit' name='submit' class='btn btn-primary'>Submit</button>
</div>
</div>
</fieldset>
</form>";
echo" </div>
</div>
</div>
<div id='bottom'></div>
</div>
</body>
</html>";
?>