-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_material.php
More file actions
47 lines (41 loc) · 1.49 KB
/
add_material.php
File metadata and controls
47 lines (41 loc) · 1.49 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
<?php
session_start();
if (!isset($_SESSION['admin'])) {
header('Location: index.php');
exit;
}
require_once('includes/database.php');
/** @var mysqli $db */
$errors = [];
$savedInput = [];
if (isset($_POST['submit'])) {
$material_name = mysqli_escape_string($db, $_POST['material_name'] ?? '');
$material_description = mysqli_escape_string($db, $_POST['material_description'] ?? '');
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Nieuw materiaal | Kiryan B.V.</title>
</head>
<body>
<form action="" method="post">
<h2>Materiaal toevoegen [admin]</h2>
<div class="form-row">
<label for="material_name">Materiaal naam</label>
<input type="text" id="material_name" name="material_name" value="<?= htmlentities($savedInput['material_name']) ?>">
<div class="form-error"><?= $errors['material_name'] ?? '' ?></div>
</div>
<div class="form-row">
<label for="material_description">Materiaal beschrijving</label>
<textarea name="material_description" id="material_description" cols="30" rows="8"><?= htmlentities($savedInput['material_description']) ?></textarea>
<div class="form-error"><?= $errors['material_description'] ?? '' ?></div>
</div>
<button>Materiaal toevoegen</button>
</form>
</body>
</html>