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

20 lines
630 B
PHP
Raw Normal View History

2022-11-16 13:27:51 +00:00
<?php
session_start();
$pageTitle = 'iBuy - Admin';
$stylesheet = '../assets/ibuy.css';
2022-11-19 15:38:26 +00:00
require_once '../../functions.php';
adminCheck();
2022-11-16 13:27:51 +00:00
$pageContent = '<h1>Categories <a href="addCategory.php">Add</a></h1>
<ul>'. populateContent() .'</ul>';
require '../../layout.php';
function populateContent() {
$output = '';
$cats = fetchCats();
foreach ($cats as &$cat) {
2022-11-19 15:38:26 +00:00
$output .= '<li>'. $cat['name'] . ' <a href="editCategory.php?category_id='. urlencode($cat['category_id']) .'">edit</a> <a href="deleteCategory.php?category_id='. urlencode($cat['category_id']). '">delete</a></li>';
2022-11-16 13:27:51 +00:00
}
return $output;
}
?>