CSY2028-assignment-1/public/admin/deleteCategory.php

20 lines
587 B
PHP
Raw Permalink Normal View History

2022-11-19 15:43:06 +00:00
<?php
session_start();
$pageTitle = 'iBuy - Delete Category';
$stylesheet = '../assets/ibuy.css';
require_once '../../functions.php';
2022-11-20 21:33:42 +00:00
adminCheck(); //checks to see if user is logged in as admin
2022-11-19 15:43:06 +00:00
if (isset($_GET['category_id'])) {
2022-11-20 13:20:58 +00:00
$pdo = startDB();
2022-11-19 15:43:06 +00:00
$stmt = $pdo->prepare('DELETE FROM category WHERE category_id= :category_id');
$values = [
'category_id' => $_GET['category_id']
];
$stmt->execute($values);
echo '<script>window.location.href = "adminCategories.php";</script>';
}
else {
echo '<script>window.location.href = "adminCategories.php";</script>';
}
?>