-
Notifications
You must be signed in to change notification settings - Fork 1
/
admin_role.php
64 lines (52 loc) · 1.8 KB
/
admin_role.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
<?php
require 'session_validator.php';
require_once 'conn.php';
$id = $_GET['id'];
$query = mysqli_query($con, "select * from admin where id='$id'");
$fetch = mysqli_fetch_array($query);
$username = $fetch['fname']." ".$fetch['lname'];
if(isset($_POST['submit'])){
$role = $_POST['status'];
$update = "update admin set status='$role' where id='$id'";
$query = mysqli_query($con, $update) or die(mysqli_error($con));
if($query == 1){
header('location:add_admin.php');
}
}
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<?php include "stylesheet.php";?>
<title>S-Hub | Change role</title>
</head>
<body>
<div class="container"> <!-- bootstrap container start -->
<div class="row justify-content-center"> <!-- bootstrap container row -->
<div class="col-sm-6">
<div class="card p-4 mb-4 mt-5">
<h5 class="card-title text-center mb-5">Change Role of <?= $username?></h5>
<form method="post"> <!-- bootstrap form start -->
<div class="form-row">
<div class="form-group col">
<label for="" class="sr-only">Select role</label>
<select name="status" class="form-control" required="">
<option value="">Select Role for <?= $username?></option>
<option value="admin">Admin</option>
<option value="teacher">Teacher</option>
</select>
</div>
</div>
<button type="submit" name="submit" class="btn btn-primary btn-block">Update</button>
</form> <!-- bootstrap form end -->
</div>
</div>
</div> <!-- bootstrap container row end -->
</div> <!-- bootstrap container end -->
<?php include "script.php";?>
</body>
</html>