-
Notifications
You must be signed in to change notification settings - Fork 0
/
student_profile.php
124 lines (96 loc) · 2.49 KB
/
student_profile.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
<?php
session_start();
if(!isset($_SESSION['username']))
{
header("location:login.php");
}
elseif($_SESSION['usertype']=='admin')
{
header("location:login.php");
}
$host="localhost";
$user="root";
$password="";
$db="project1";
$data=mysqli_connect($host,$user,$password,$db);
$name=$_SESSION['username'];
$sql="SELECT * FROM user WHERE username='$name' ";
$result=mysqli_query($data,$sql);
$info=mysqli_fetch_assoc($result);
if(isset($_POST['update_profile']))
{
$s_email=$_POST['email'];
$s_phone=$_POST['phone'];
$s_password=$_POST['password'];
$sql2="UPDATE user SET email='$s_email', phone='$s_phone', password='$s_password' WHERE username='$name' ";
$result2=mysqli_query($data,$sql2);
if($result2)
{
header('location:student_profile.php');
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>admin dashboard</title>
<?php
include 'student_css.php';
?>
<style type="text/css">
label{
display: inline-block;
text-align: right;
width: 100px;
padding-top: 10px;
padding-bottom: 10px;
}
.div_deg{
background-color: lightcyan;
width: 500px;
padding-top: 70px;
padding-bottom: 70px;
}
</style>
</head>
<body>
<?php
include 'student_sidebar.php';
?>
<div class="content">
<center>
<h1>Update Profile</h1>
<br><br>
<form action="#" method="POST">
<div class="div_deg">
<!-- <div>
<label for="">Name</label>
<input type="text" name="name"
value="<?php echo"{$info['username']}" ?>">
</div> KEEPING THE USERNAME UNIQUE!!-->
<div>
<label for="">email</label>
<input type="email" name="email"
value="<?php echo"{$info['email']}" ?>">
</div>
<div>
<label for="">Phone</label>
<input type="number" name="phone"
value="<?php echo"{$info['phone']}" ?>">
</div>
<div>
<label for="">password</label>
<input type="text" name="password"
value="<?php echo"{$info['password']}" ?>">
</div>
<div>
<input type="submit" class="btn btn-primary" name="update_profile" value="Update">
</div>
</div>
</form>
</center>
</div>
</body>
</html>