-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit.php
59 lines (46 loc) · 1.56 KB
/
edit.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
<?php
require_once("config.php");
$stmt = $conn->prepare("SELECT * FROM menu WHERE id = ?");
$stmt->bind_param("i", $_GET['id']);
$stmt->execute();
$run = $stmt->get_result();
$result = mysqli_fetch_assoc($run);
$oude_prijs = $result['prijs'];
$oude_titel = $result['naam'];
$oude_omschrijving = $result['omschrijving'];
if(isset($_POST['wijzig_button'])){
$omschrijving = $_POST['omschrijving'];
$titel = $_POST['titel'];
$prijs = $_POST['prijs'];
$stmt = $conn->prepare("UPDATE menu SET omschrijving = ?, naam = ?, prijs = ? WHERE id = ?");
$stmt->bind_param("ssii", $omschrijving, $titel, $prijs, $_GET['id']);
$stmt->execute();
header('Location: admin-panel.php');
exit;
}
require_once("header.php");
?>
<!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">
<title>Document</title>
<link rel="stylesheet" href="styles/main.css">
</head>
<body>
<div class="edit-form-container">
<form method="POST">
<?php
echo '
<h3>titel:</h3> <input typ="text" name="titel" value="'.$oude_titel.'">
<h3>omschrijving: </h3><input typ="text" name="omschrijving" value="'.$oude_omschrijving.'">
<h3>prijs: </h3><input typ="text" name="prijs" value="'.$oude_prijs.'">
<button type="submit" name="wijzig_button">submit</button>
';
?>
</form>
</div>
</body>
</html>