-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit-profile.php
More file actions
103 lines (94 loc) · 4.82 KB
/
edit-profile.php
File metadata and controls
103 lines (94 loc) · 4.82 KB
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
<?php session_start();
include_once('includes/config.php');
if (strlen($_SESSION['id']==0)) {
header('location:logout.php');
} else{
//Code for Updation
if(isset($_POST['update']))
{
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$contact=$_POST['contact'];
$userid=$_SESSION['id'];
$msg=mysqli_query($con,"update users set fname='$fname',lname='$lname',contactno='$contact' where id='$userid'");
if($msg)
{
echo "<script>alert('Profile updated successfully');</script>";
echo "<script type='text/javascript'> document.location = 'profile.php'; </script>";
}
}
?>
<!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, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<title>Edit Profile | Registration and Login System</title>
<link href="https://cdn.jsdelivr.net/npm/simple-datatables@latest/dist/style.css" rel="stylesheet" />
<link href="css/styles.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/js/all.min.js" crossorigin="anonymous"></script>
</head>
<body class="sb-nav-fixed">
<?php include_once('includes/navbar.php');?>
<div id="layoutSidenav">
<?php include_once('includes/sidebar.php');?>
<div id="layoutSidenav_content">
<main>
<div class="container-fluid px-4">
<?php
$userid=$_SESSION['id'];
$query=mysqli_query($con,"select * from users where id='$userid'");
while($result=mysqli_fetch_array($query))
{?>
<h1 class="mt-4"><?php echo $result['fname'];?>'s Profile</h1>
<div class="card mb-4">
<form method="post">
<div class="card-body">
<table class="table table-bordered">
<tr>
<th>First Name</th>
<td><input class="form-control" id="fname" name="fname" type="text" value="<?php echo $result['fname'];?>" required /></td>
</tr>
<tr>
<th>Last Name</th>
<td><input class="form-control" id="lname" name="lname" type="text" value="<?php echo $result['lname'];?>" required /></td>
</tr>
<tr>
<th>Contact No.</th>
<td colspan="3"><input class="form-control" id="contact" name="contact" type="text" value="<?php echo $result['contactno'];?>" pattern="[0-9]{10}" title="10 numeric characters only" maxlength="10" required /></td>
</tr>
<tr>
<th>Email</th>
<td colspan="3"><?php echo $result['email'];?></td>
</tr>
<tr>
<th>Reg. Date</th>
<td colspan="3"><?php echo $result['posting_date'];?></td>
</tr>
<tr>
<td colspan="4" style="text-align:center ;"><button type="submit" class="btn btn-primary btn-block" name="update">Update</button></td>
</tr>
</tbody>
</table>
</div>
</form>
</div>
<?php } ?>
</div>
</main>
<?php include('includes/footer.php');?>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<script src="js/scripts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js" crossorigin="anonymous"></script>
<script src="assets/demo/chart-area-demo.js"></script>
<script src="assets/demo/chart-bar-demo.js"></script>
<script src="https://cdn.jsdelivr.net/npm/simple-datatables@latest" crossorigin="anonymous"></script>
<script src="js/datatables-simple-demo.js"></script>
</body>
</html>
<?php } ?>