-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathidUpdate.php
75 lines (54 loc) · 2 KB
/
idUpdate.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
<!--Pantelis Xiourouppas - 160056307 -->
<?php
include 'connect.php';
$id = $_GET['idUpdate'];
$sql = "Select * from `users` where id=$id";
$result = mysqli_query($con, $sql);
$row = mysqli_fetch_assoc($result);
$name = $row['name'];
$email = $row['email'];
$password = $row['password'];
if (isset($_POST['UpdateButton'])) {
$name = $_POST['UserName'];
$email = $_POST['UserEmail'];
$password = $_POST['UserPassword'];
$sql = "update `users` set id=$id , name ='$name', email='$email', password='$password' where id=$id";
$result = mysqli_query($con, $sql);
if ($result) {
header('location:adminpage.php');
} else {
die(mysqli_error($con));
}
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Fill in Details</title>
<link href="css/style.css" rel="stylesheet">
</head>
<body>
<!-- Navigation Bar -->
<div class="navbar">
<a href="#"><img src="images/Logo.png" class="logo"></a>
<ul>
<li><a href="user.php">Add User</a></li>
<li><a href="additem.php">Add Item</a></li>
<li><a href="adminpage.php">Database</a></li>
<li><a href="logout.php">Log Out</a></li>
</ul>
</div>
<!-- Input box -->
<div class="addingBox">
<form class="addingInputs" method="post">
<h1>Update User Account</h1>
<input type="text-box" class="formInput" name="UserName" autocomplete="off" value="<?php echo $name ?>">
<input type="text-box" class="formInput" name="UserEmail" autocomplete="off" value="<?php echo $email ?>">
<input type="text-box" class="formInput" name="UserPassword" autocomplete="off" value="<?php echo $password?>">
<button type="submit" class="submitButton" name="UpdateButton">Update</button>
</form>
</body>
</div>
</html>