-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathadd-category.php
40 lines (31 loc) · 1.18 KB
/
add-category.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
<?php
include "partials/header.php";
if(!isset($_SESSION['user_is_admin'])){
header("location: " . ROOT_URL . "logout.php");
//destroy all sessions and redirect user to login page
session_destroy();
}
$title = $_SESSION["add-category-data"]['title'] ?? null;
$description = $_SESSION["add-category-data"]['description'] ?? null;
unset($_SESSION['add-category-data'])
?>
<section class="form__section">
<div class="container form__section-container">
<h2>Add Category</h2>
<?php if(isset($_SESSION['add-category'])): ?>
<div class="alert__message error">
<p><?=$_SESSION['add-category'];
unset($_SESSION['add-category']);
?></p>
</div>
<?php endif?>
<form action="<?= ROOT_URL ?>admin/add-category-logic.php" method="POST">
<input type="text" name="title" value = "<?=$title?>"placeholder="Title">
<textarea rows="4" name="description" value = "<?=$description?>"placeholder="Description"></textarea>
<button type="submit" name="submit" class="btn">Add Category</button>
</form>
</div>
</section>
<?php
include "../partials/footer.php";
?>