forked from vikassinghv34/Book_publish_Management_System
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AdminUserEdit.php
42 lines (29 loc) · 1.18 KB
/
AdminUserEdit.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
<?php include('admin.php');?>
</head>
<body>
<?php
include "conn.php"; // Using database connection file here
$Id = $_GET['Id']; // get id through query string
$query = mysqli_query($conn,"select * from users where userID='$Id'"); // select query
$row = mysqli_fetch_array($query); // fetch data
if(isset($_POST['Update'])) // when click on Update button
{
$FullName = $_POST['FullName'];
$PhoneNumber = $_POST['PhoneNumber'];
$pwd=$_POST['pwd'];
$query=mysqli_query($conn,"UPDATE `users` SET userName='$FullName', userNumber='$PhoneNumber', userPassword='$pwd' WHERE userId='$Id'");
if($query){
// redirects to all records page
echo '<script>window.location.href = "AdminManageUser.php";</script>';
}else{
echo "Error".$sql."".mysqli_error($conn);
}
}
?>
<h3>Update Data</h3>
<form method="POST">
<input type="text" name="FullName" value="<?php echo $row['userName'] ?>">
<input type="text" name="PhoneNumber" value="<?php echo $row['userNumber'] ?>">
<input type="text" name="pwd" value="<?php echo $row['userPassword'] ?>">
<input type="submit" name="Update" value="Update">
</form>