-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_student.php
130 lines (117 loc) · 3.23 KB
/
update_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
<?php
session_start();
error_reporting(0);
if(!isset($_SESSION['username']))
{
header("location:index.php");
}
elseif($_SESSION['usertype']=='student')
{
header("location:index.php");
}
$host="localhost";
$user="root";
$password="";
$db="sgs";
$conn=mysqli_connect($host,$user,$password,$db);
$id=$_GET['student_id'];
$sql="SELECT * FROM studentlist WHERE id='$id'";
$result=mysqli_query($conn,$sql);
$info=$result->fetch_assoc();
if(isset($_POST['save_update']))
{
$enroll=$_POST['enroll'];
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$password=$_POST['password'];
$query="UPDATE studentlist SET enroll='$enroll', firstname='$firstname',lastname='$lastname',email='$email',phone='$phone',password='$password' WHERE id='$id'";
$result2=mysqli_query($conn,$query);
if($result2)
{
header("location:view_student.php");
}
}
?>
<html>
<head>
<title>Update Student Page</title>
<link rel="stylesheet" type="text/css" href="css/admin-style.css">
<style type="text/css">
label
{
display: inline-block;
text-align: right;
width: 100px;
padding-top: 10px;
padding-bottom: 10px;
font-size: 16px;
}
.btn
{
padding: 5px 10px;
background: #fff;
border-color: #de3163;
border-radius: 30px;
}
.btn:hover{
background: #de3163;
color: #fff;
border-radius: 30px;
}
.div_deg
{
background-color: #fcf4a3;
width: 500px;
padding-top: 70px;
padding-bottom: 50px;
border-radius: 40px;
}
</style>
</head>
<body>
<!----------------------------------------sidebar code------------------------------------->
<?php
include 'admin_sidebar.php';
?>
<!------------------------------------------------------------------------------------------>
<div class="content">
<center>
<h1>Update student data</h1>
<div class="div_deg">
<form method="POST" action="#">
<div>
<label>Enroll No.</label>
<input type="text" name="enroll" value="<?php echo "{$info['enroll']}";?>">
</div>
<div>
<label>First Name</label>
<input type="text" name="firstname" value="<?php echo "{$info['firstname']}";?>">
</div>
<div>
<label>Last Name</label>
<input type="text" name="lastname" value="<?php echo "{$info['lastname']}";?>">
</div>
<div>
<label>Email</label>
<input type="text" name="email" value="<?php echo "{$info['email']}";?>">
</div>
<div>
<label>Phone</label>
<input type="text" name="phone" value="<?php echo "{$info['phone']}";?>">
</div>
<div>
<label>Password</label>
<input type="text" name="password" value="<?php echo "{$info['password']}";?>">
</div>
<br><br>
<div>
<input type="submit" class="btn" name="save_update" value="Update">
</div>
</form>
</div>
</center>
</div>
</body>
</html>