forked from ChristyBiju/Student-Result-Management-System
-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit-student.php
183 lines (163 loc) · 5.87 KB
/
edit-student.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
<?php
session_start();
$showAlert = false;
$showError = false;
include "includes/connection.php";
if(!isset($_SESSION['loggedin']) || $_SESSION['loggedin']!=true){
header("location: index.php");
exit;
}
$stid = intval($_GET['stid']);
if($_SERVER["REQUEST_METHOD"] == "POST"){
$fullname = $_POST['fullname'];
$rollno = $_POST['rollno'];
$email = $_POST['email'];
$gender = $_POST['gender'];
$dob = $_POST['birthDate'];
$status = $_POST['status'];
$addsql = "UPDATE `student` set student.Name = '$fullname', student.Roll_No = '$rollno', student.Email = '$email', student.Gender='$gender', student.DOB = '$dob', student.status='$status' where student.reg_id = '$stid'";
$result1 = mysqli_query($conn, $addsql);
if($result1){
$showAlert = true;
}
else{
$showError = true;
}
}
?>
<!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.0">
<title>Edit Student's Info</title>
</head>
<body style=" margin : 0">
<?php include "nav.php";?>
<?php
if($showAlert){
echo '<script>alert("Record Updated Successfully!")</script>';
}
if($showError){
echo '<script>alert("Error! Try Again.")</script>';
}
?>
<div style="width : 70%; margin : auto auto; height : 900px; border : 2px solid rgb(200, 200, 200); margin-top : 15px;background-color: rgb(236, 236, 236)">
<h2 style="text-align:center; font-size : 30px">Student Admission Details</h2>
<form method="post" >
<?php
$sql = "SELECT student.Name, student.Roll_No, student.reg_id,student.status,student.Email,student.Gender,student.Reg_date,student.DOB,branch.branch, semester.semester from student join branch on student.branch_id = branch.branch_id join semester on student.sem_id = semester.sem_id where student.reg_id = $stid";
$result = mysqli_query($conn,$sql);
$num = mysqli_num_rows($result);
$c = 1;
if($num > 0){
while($row = mysqli_fetch_assoc($result)){
?>
<div style=" width : 75%; margin:auto auto; font-size : 20px">
<p>
<label for="fullname">Full name :
<input name="fullname" value="<?php echo $row['Name'];?>" style="width : 50%;padding : 5px;font-size:17px"/>
</label>
</p>
<p style="margin-top : 50px">
<label for="rollno">Roll No :
<input name="rollno" value="<?php echo $row['Roll_No'];?>" style="width : 50%;padding : 5px;font-size:17px"/>
</label>
</p>
<p>
<label for="email">Email :
<input type="email" name="email" value="<?php echo $row['Email'];?>" style="width : 50%;padding : 5px;font-size:17px" />
</label>
</p>
<p>
Gender :
<?php
$gndr = $row['Gender'];
if($gndr == "Male"){
?>
<label><input type="radio" name="gender" value="Male" checked /> Male</label>
<label><input type="radio" name="gender" value="Female" /> Female</label>
<label><input type="radio" name="gender" value="Other" /> Other</label>
<?php
}
?>
<?php
if($gndr == "Female"){
?>
<label><input type="radio" name="gender" value="Male" /> Male</label>
<label><input type="radio" name="gender" value="Female" checked/> Female</label>
<label><input type="radio" name="gender" value="Other" /> Other</label>
<?php
}
?>
<?php
if($gndr == "Other"){
?>
<label><input type="radio" name="gender" value="Male" /> Male</label>
<label><input type="radio" name="gender" value="Female" /> Female</label>
<label><input type="radio" name="gender" value="Other" checked/> Other</label>
<?php
}
?>
</p>
<p>
<label for="birthDate">DOB :
<input type="date" name="birthDate" value="<?php echo $row['DOB'];?>" style="padding : 5px;font-size:17px; width : 180px"/></label>
</p>
<div style="margin-left : 50px; margin-bottom:50px">
<label for="branch">Branch :
<input name="branch" value="<?php echo $row['branch'];?>" style="width : 50%;padding : 5px;font-size:17px" readonly/>
</label>
</select>
</div>
<div style="margin-left : 50px; margin-bottom:50px">
<label for="semester">Semester :
<input name="semester" value="<?php echo $row['semester'];?>" style="width : 50%;padding : 5px;font-size:17px" readonly/>
</label>
</select>
</div>
<p>
Reg Date : <?php echo $row['Reg_date'];?>
</p>
<!-- </div> -->
<p>
Status :
<?php
$s = $row['status'];
if($s == 1){
?>
<label><input type="radio" name="status" value="1" required="required" checked /> Active</label>
<label><input type="radio" name="status" value="0" required /> Block</label>
<?php
}?>
<?php
if($s == 0){
?>
<label><input type="radio" name="status" value="1" required="required" /> Active</label>
<label><input type="radio" name="status" value="0" required="required" checked /> Block</label>
<?php
}?>
</p>
<div style="float:right; margin-right : 80px">
<button type="submit" style="width : 90px; padding : 7px;font-size : 17px; background-color : rgba(42, 42, 120, 0.909);color:white;">Update</button>
</div>
</form>
<?php
}
}
?>
</div>
</body>
</html>