-
Notifications
You must be signed in to change notification settings - Fork 2
/
update_student_class.php
192 lines (181 loc) · 6.34 KB
/
update_student_class.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
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
<?php
/**
* Update Student Class
* * php version 8.1
*
* @category Student
*
* @package None
*
* @author Waqas <waqaskanju@gmail.com>
*
* @license http://www.waqaskanju.com/license MIT
*
* @link www.waqaskanju.com
**/
session_start();
require_once 'sand_box.php';
$link=$LINK;
?>
<?php
Page_header("Update Student Class");
?>
<script>
// This is default function. Here i am using it To update student class. and statudent status
function view_existing_subjects(){
update_student_class();
update_student_status();
}
</script>
</head>
<body>
<?php require_once 'nav.html';?>
<div class="bg-primary text-white text-center">
<?php
$selected_school=$SCHOOL_NAME;
if (isset($_GET['submit'])) {
$class=$_GET['class_exam'];
$class=Validate_input($class);
if(!isset($_GET['status'])){
$_GET['status']=1;
}
$student_status=$_GET['status'];
$student_status=Validate_input($student_status);
} else {
$class=$CLASS_NAME;
$status="Active";
}
if ($STUDENT_CHANGES!=1) {
echo '<div class="bg-danger text-center"> Not allowed!! </div>';
exit;
}
?>
<h4 class="bg-warning">
Form for Changing Class: <?php echo $class;?>
Students Class Name
Selected School <?php echo $selected_school ?>
</h4>
</div>
<div class="container-fluid">
<div class="container-fluid no-print">
<form action="#" method="GET">
<div class="row">
<?php
$class_name=$CLASS_NAME;
$school_name=$SCHOOL_NAME;
Select_class($class_name);
Select_school($school_name);?>
</div>
<button class="no-print btn btn-primary mt-2" type="submit"
name="submit">
Show Class Students
</button>
</form>
</div>
<?php
$q="SELECT Roll_No,Class_No,Name,FName,Class,Status,Graduation_Year from students_info
WHERE Class='$class' AND School='$selected_school' AND Status='1'
order by Roll_No ASC";
$exe=mysqli_query($link, $q);
$tab_index=1;
$school_name=$SCHOOL_NAME;
$school_id=Convert_School_Name_To_id($school_name);
$class_names_array=Select_Single_Column_Array_data(
"Name", "school_classes", "School_Id", "$school_id"
);
?>
<div class="row mt-1 mb-3 bg-info">
<div class="col-sm-1">Index</div>
<div class="col-sm-1 text-wrap">Roll No</div>
<div class="col-sm-2 text-wrap">Name</div>
<div class="col-sm-1 text-wrap">Class No</div>
<div class="col-sm-1 text-wrap">Class Name</div>
<div class="col-sm-1 text-wrap">Status</div>
<div class="col-sm-1 text-wrap">Graduation Year</div>
<div class="col-sm-2 text-wrap"> Response </div>
</div>
<?php
while ($qfa=mysqli_fetch_assoc($exe)) {
$name=$qfa['Name'];
$roll_no=$qfa['Roll_No'];
$current_class=$qfa['Class'];
$student_status=$qfa['Status'];
$class_no=$qfa['Class_No'];
$graduation_year=$qfa['Graduation_Year'];
?>
<form class="" action="#" id="<?php echo $roll_no;?>_form">
<div class="row mb-3">
<!-- tab index used as serial no of form. in addition to tab index. -->
<div class="col-sm-1">
<!-- Tab Index as Serial No -->
<?php echo $tab_index; ?>
</div>
<!-- Roll Number Read only that is why name field empty-->
<div class="col-sm-1">
<input type="number" class="form-control-plaintext"
value="<?php echo $roll_no ?>" readonly>
</div>
<!-- Student Name Read only that is why name field empty -->
<div class="col-sm-2">
<input type="text" class="form-control-plaintext"
readonly value="<?php echo $name ?>">
</div>
<!-- Student Class no change -->
<div class="col-sm-1">
<input type="number" class="form-control-plaintext"
name='class_no'
id="<?php echo $roll_no;?>_student_class_no"
value="<?php echo $class_no ?>" required onchange='update_student_class_no(<?php echo $roll_no;?>)'>
</div>
<!-- for selecting class; rollnoclass -->
<div class="col-sm-1">
<select class='form-control' name='class_name'
id="<?php echo $roll_no;?>_class_name" tabindex="<?php echo $tab_index;?>"
required onchange='update_student_class(<?php echo $roll_no;?>)'>
<option value=''>Select Class </option>
<?php
$selected_class=$current_class;
for ($i=0;$i<count($class_names_array);$i++) {
echo "<option value='$class_names_array[$i]'";
if ($selected_class==$class_names_array[$i]) {
echo "selected";
}
echo"> $class_names_array[$i] </option> ";
}
echo " </select>";
?>
</div>
<!-- for Selecting Student Status -->
<div class="col-sm-1">
<select class='form-control' name='student_status'
id="<?php echo $roll_no;?>_student_status"
required onchange='update_student_status(<?php echo $roll_no;?>)'>
<option value=''>Select Status </option>
<option value='1' <?php if ($student_status==1) {echo "selected";}?>>Active</option>
<option value='0' <?php if ($student_status==0) { echo "selected";}?>>Struck Off</option>
<option value='2' <?php if ($student_status==2) { echo "selected";}?>>Graduate</option>
</select>
</div>
<!-- Graduation Year selection -->
<div class="col-sm-1">
<input type="number" class="form-control-plaintext"
name='graduation_year' placeholder="graduation year"
id="<?php echo $roll_no;?>_graduation_year"
value="<?php echo $graduation_year;?>" min="2020" max="<?php echo date('Y')?>" onchange='update_graduation_year(<?php echo $roll_no;?>)'>
</div>
<!-- For showing Response rollresponse -->
<div class="col-sm-2">
<span id="<?php echo $roll_no;?>_class_response"
class="form-control-plaintext"></span>
<!-- For Selecing roll no. -->
</div>
</div> <!-- End of Row -->
</form>
<?php
$tab_index++;
}
?>
</div> <!-- End of Container -->
<script src="js/update_class_name.js">
</script>
<?php Page_close(); ?>