-
Notifications
You must be signed in to change notification settings - Fork 0
/
Student_edit.php
231 lines (167 loc) · 5.79 KB
/
Student_edit.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
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
<?php
//connect to my sql
$conn = mysqli_connect('localhost','root','123456','universitymanagment');
session_start();
$c=$_SESSION['aid'];
$d=$_SESSION['psw'];
$r="select * from student_details where student_id=$c and PASSWORD=$d";
$rm="select * from mess where student_id=$c";
$r1=mysqli_query($conn,$r);
$r2=mysqli_query($conn,$r);
$rm1=mysqli_query($conn,$rm);
?>
<html>
<head>
</head>
<body>
<style>
div{
background-image: linear-gradient(to right, rgba(255,0,0,0), rgba(255,0,0,1));
height: auto;
}
/* Full-width input fields */
input[type=text], input[type=password],input[type=Number],input[type=date] {
width: 30%;
padding: 12px 20px;
margin: 8px 0;
height:10px;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
/* Set a style for all buttons */
button {
background-color: green;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 25%;
}
/* Extra styles for the cancel button */
.cancelbtn {
padding: 14px 20px;
background-color: #f44336;
width=25%;
}
/* Float cancel and signup buttons and add an equal width */
/* Add padding to container elements
.container1 {
width:100%;
padding: 16px;
background: url(C:\Users\hp\Desktop\images.jpg);
background-size: contain;
background-repeat: no-repeat;
}*/
/* Clear floats */
.clearfix::after {
content: "";
clear: both;
display: table;
height:30px;
}
/* Change styles for cancel button and signup button on extra small screens */
label{
min-width:180px;
display: inline-block;
}
</style>
<title>
Register</title>
<h2>Edit Student Information</h2>
<?php while($row=mysqli_fetch_assoc($r1)):?>
<form method="POST" action="Student_edit.php" style="border:1px solid #ccc">
<div>
<class="container1">
<fieldset>
<legend>Personal details</legend>
<label><b>Name </b> </label>
<input type="text" placeholder="Enter name" name="sname" value="<?php echo $row['student_name'];?> " required ><br>
<label><b>Father's Name</b></label>
<input type="text" placeholder="Enter Name" name="fname" value="<?php echo $row['father_name'];?>" required ><br>
<label><b>Mother's Name</b></label>
<input type="text" placeholder="Enter Name" name="mname" value="<?php echo $row['mother_name'];?>" required ><br>
<label><b>Date of Birth</b></label>
<input type="date" placeholder="Enter DOB in YYYY/MM/DD" name="DOB" value="<?php echo $row['birth_date'];?>" required><br>
<label><b>Select Gender</b></label>
<input name="sex1" value="<?php echo $row['sex'];?>">
<br>
<label><b>Address</b></label>
<input type="text" placeholder="Enter Gaurdian Address" name="address" value="<?php echo $row['address'];?>" required><br>
<?php endwhile;?>
</fieldset>
<br>
<class="container2">
<fieldset>
<?php while($ro=mysqli_fetch_assoc($r2)):?>
<legend>Account details</legend>
<label><b>Select Department</b></label>
<input name="Department" value="<?php echo $ro['department_number'];?>">
<br><br>
<label><b>Select Hostel</b></label>
<input name="hostel" value="<?php echo $ro['hostel_id'];?>">
<br>
<label><b>Student ID</b></label>
<input type="Number" placeholder="Enter student id" name="student_id" value="<?php echo $ro['student_id'];?>" required><br>
<label><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="password" required><br>
<?php endwhile;?>
</fieldset>
<fieldset>
<?php while($ro1=mysqli_fetch_assoc($rm1)):?>
<legend>Mess details</legend>
<label><b>Select Mess</b></label>
<input name="mess" value="<?php echo $ro1['mess_id'];?>">
<br>
<br>
<?php endwhile;?>
</fieldset>
</div>
<br>
<div class="clearfix">
<button type="submit" name="submit" class="signupbtn" value="submit">Save changes</button>
</div>
</form>
<br>
<?php
if(isset($_POST['submit']))
{
$cou1=$_POST['sname'];
$cou2=$_POST['fname'];
$cou3=$_POST['mname'];
$cou4=$_POST['DOB'];
$cou5=$_POST['sex1'];
$cou6=$_POST['address'];
$cou7=$_POST['student_id'];
$cou8=$_POST['password'];
$cou9=$_POST['Department'];
$cou10=$_POST['hostel'];
$cou11=$_POST['mess'];
$query = "Update student_details SET student_name='$cou1' , father_name='$cou2' , mother_name='$cou3' , birth_date='$cou4' , sex='$cou5' where student_id=$cou7";
if($cou11==1)
{
$query1 = "Update mess SET mess_id='$cou11',mess_name='SRRC' where student_id=$cou7";
}
if($cou11==2)
{
$query1 = "Update mess SET mess_id='$cou11',mess_name='Darling' where student_id=$cou7";
}
if($cou11==3)
{
$query1 = "Update mess SET mess_id='$cou11',mess_name='Buddies and bites' where student_id=$cou7";
}
$run=mysqli_query($conn,$query);
$run12=mysqli_query($conn,$query1);
if($run)
{
header ("location:http://localhost/UNIVERSITY_MANAGEMENT_SYSTEM/Student_Info.php");
}
else
{
echo "There is some problem";
}
}
?>
</body>
</html>