-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit.php
85 lines (74 loc) · 2.75 KB
/
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
<!DOCTYPE html>
<html lang="en">
<?php
session_start();
$con = mysqli_connect('localhost', 'root', '');
if (empty($_SESSION['username'])) {
header('location:index.php');
}
mysqli_select_db($con, 'mms');
?>
<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">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<title>Edit User Details</title>
</head>
<body>
<style>
</style>
<div class="card">
<div class="card-header">
MMS
</div>
<div class="card-body row">
<button class="btn"> <a href="admin/admins.php">Back </a> </button>
<h5 class="card-title" style="text-align: center;margin:auto;">Edit User</h5>
</div>
</div>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST"){
$username=$_POST['username'];
$q = "select * from users where username = '$username'";
$res = mysqli_query($con, $q);
$qarr = mysqli_fetch_assoc($res);
}
else{
header('location:admin.php');
}
?>
<form id="delete" method="POST" action="delete.php">
<input type="hidden" name="username" value="<?php echo $username ?>">
</form>
<form style="margin:20px auto; width: 40vw;" method="POST" action="update.php">
<div class="form-group row">
<label for="staticEmail" class="col-sm-2 col-form-label">Email</label>
<div class="col-sm-10">
<input type="text" name='username' readonly class="form-control-plaintext" id="staticEmail" value="<?php echo $username ?>">
</div>
</div>
<div class="form-group row">
<label for="staticEmail" class="col-sm-2 col-form-label">User Type</label>
<div class="col-sm-10">
<input type="text" readonly class="form-control-plaintext" id="staticEmail" value="<?php echo $qarr['user_type']; $_SESSION['user_type'] = $qarr['user_type'];?>">
</div>
</div>
<div class="form-group row">
<label for="inputPassword" class="col-sm-2 col-form-label">Name</label>
<div class="col-sm-10">
<input type="text" name='name' class="form-control" value="<?php echo $qarr['name'] ?>" placeholder="Name">
</div>
</div>
</div>
<div class="form-group row">
<label for="inputPassword" class="col-sm-2 col-form-label">Password</label>
<div class="col-sm-10">
<input type="password" name='password' class="form-control" id="inputPassword" placeholder="Password" value="<?php echo $qarr['password'] ?>">
</div>
</div>
<button class="btn btn-danger" type="submit" form="delete" >Delete User</button>
<button class="btn btn-primary" type="submit" >Update</button>
</form>
</body>
</html>