-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit.php
More file actions
61 lines (48 loc) · 2.48 KB
/
edit.php
File metadata and controls
61 lines (48 loc) · 2.48 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
<!DOCTYPE html>
<html lang="en">
<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://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="includes/style.css">
<title>Edit</title>
</head>
<body>
<?PHP
session_start();
require 'db.php';
// Haal eerst de data op van de gebruiker
$id = $_GET['id'];
$query = "SELECT * FROM users WHERE id = '$id'";
$query_result = mysqli_fetch_assoc(mysqli_query($conn,$query));
// Daarna gaan we de data in een formulier duwen, klaar om te editeren...
?>
<div class="container">
<div class="row">
<form action="editpost.php" method="post" enctype="multipart/form-data">
<div class="form-group">
<label>username</label>
<input type="text" class="form-control" name="username" value="<?PHP echo $query_result['name']?>" required>
Hier geef ik onzichtbaar ook de id mee aan het posten van ons formulier naar editpost.php
<input type="hidden" name="id" value="<?php echo $query_result['id']?>">
</div>
<div class="form-group">
<label>Password (leave blank if no change)</label>
<input type="password" class="form-control" name="password" >
</div>
<div class="form-group">
<label>Email</label>
<input type="text" class="form-control" name="email" value="<?PHP echo $query_result['email']?>">
</div>
<div class="form-group">
<img class="img-fluid avatar" src="<?PHP echo $query_result['avatar']?>">
<label>Avatar</label>
<input type="file" class="form-control" name="avatar">
</div>
<button type="submit" class="btn btn-primary">Edit user</button>
</form>
</div>
</div>
</body>
</html>