-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit_admin.php
More file actions
135 lines (120 loc) · 5.6 KB
/
edit_admin.php
File metadata and controls
135 lines (120 loc) · 5.6 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
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
131
132
133
134
135
<?php
include("connect.php");
$admin_id = $_REQUEST['admin_id'];
$query = "SELECT * from admin where admin_id='" . $admin_id . "'";
$result = mysqli_query($con, $query) or die(mysqli_error($con));
$row = mysqli_fetch_assoc($result);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>edit_admin</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
<style>
body {
background-color: #000;
color: #ffffff;
}
.myform {
color: #ffffff;
margin: 100px 320px;
background-color: #000;
border-radius: 15px;
border: 1px solid white;
}
.myform h1 {
padding-bottom: 10px;
padding-top: 10px;
}
.myform label {
font-size: 20px;
font-weight: 600;
letter-spacing: 1px;
padding-left: 40px;
}
.tabledata {
padding-top: 10px;
padding-bottom: 20px;
padding-right: 70px;
}
#inputbox {
width: 110%;
}
.other-link a {
margin: 5px 30px;
text-decoration: none;
text-transform: uppercase;
padding: 13px 25px;
background-color: #198754;
color: white;
border-radius: 8px;
font-size: 19px;
transition: background-color 0.3s;
}
.other-link a:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<div class="myform">
<?php
$status = "";
if (isset($_POST['new']) && $_POST['new'] == 1) {
$admin_id = $_REQUEST['admin_id'];
$username = $_REQUEST['username'];
$email = $_REQUEST['email'];
$password = $_REQUEST['password'];
$fullName = $_REQUEST['fullName'];
$mobile = $_REQUEST['mobile'];
$type = $_REQUEST['type'];
$update = "update admin set username='" . $username . "', email='" . $email . "',password='" . $password . "',fullName='" . $fullName . "',mobile='" . $mobile . "',type='" . $type . "' where admin_id='" . $admin_id . "'";
mysqli_query($con, $update) or die(mysqli_error($con));
$status = "admin Updated Successfully. </br></br>
<a href='admin_adminview.php'>View Updated admin record</a>";
echo '<p style="color:#FF0000;">' . $status . '</p>';
} else {
?>
<div>
<form name="form" method="post" action="">
<input type="hidden" name="new" value="1" />
<h1 style="font-family: Algerian;" align="center">Update admin</h1>
<input name="admin_id" type="hidden" value="<?php echo $row["admin_id"]; ?>" />
<table>
<tr>
<td class="tabledata"><label for="username">Username:</label></td>
<td class="tabledata"><input type="text" name="username" placeholder="Enter username" required value="<?php echo $row['username']; ?>" /></td>
</tr>
<tr>
<td class="tabledata"><label for="email">Email:</label></td>
<td class="tabledata"><input type="text" name="email" placeholder="Enter email" required value="<?php echo $row['email']; ?>" /></td>
</tr>
<tr>
<td class="tabledata"><label for="password">Password:</label></td>
<td class="tabledata"><input type="text" name="password" placeholder="Enter password" required value="<?php echo $row['password']; ?>" /></td>
</tr>
<tr>
<td class="tabledata"><label for="fullName">Full Name:</label></td>
<td class="tabledata"><input type="text" name="fullName" placeholder="Enter fullName" required value="<?php echo $row['fullName']; ?>" /></td>
</tr>
<tr>
<td class="tabledata"><label for="mobile">Mobile:</label></td>
<td class="tabledata"><input type="number" name="mobile" placeholder="mobile" required value="<?php echo $row['mobile']; ?>" /></td>
</tr>
<tr>
<td class="tabledata"><label for="date_of_join">Date of Joining:</label></td>
<td class="tabledata"><input type="text" name="type" placeholder="type" required value="<?php echo $row['type']; ?>" /></td>
</tr>
</table>
<p>
<input style=" margin:0px 30px; padding:10px 50px;" class="btn btn-lg btn-success" name="submit" type="submit" value="Update" />
<span class="other-link"> <a href="add_admin.php">click to add admin</a></span>
</p>
</form>
<?php } ?>
</div>
</div>
</body>
</html>