<?php

require_once 'CatManager.php';
require_once 'Connection.php';
require_once 'TableGateway.php';
require_once 'validateManager.php';
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
    if (!isset($_GET['id'])) {
        die("Illegal request");
    }
    $id = $_GET['id'];
    $connection = Connection::getInstance();
    $gateway = new TableGateway($connection);
    $statement = $gateway->getManagerById($id);
    $row = $statement->fetch(PDO::FETCH_ASSOC);
    if (!$row) {
        die("Illegal request");
    }
} else {
    if ($_SERVER['REQUEST_METHOD'] === 'POST') {
        if (!isset($_POST['id'])) {
            die("Illegal request");
        }
        $id = $_POST['id'];
        $row = $formdata;
    } else {
        die("Illegal request");
    }
}
?>
<!DOCTYPE html>
require_once 'Classes/Connection.php';
require_once 'TableGateway.php';
require_once 'Classes/productTable.php';
//
//if (!is_logged_in()) {
//    header("Location: login_form.php");
//}
if (!isset($_GET) || !isset($_GET['id'])) {
    die('Invalid request');
}
$id = $_GET['id'];
$connection = Connection::getInstance();
$categoryGateway = new TableGateway($connection);
$productGateway = new productTable($connection);
$Category = $categoryGateway->getManagerById($id);
$product = $productGateway->getProductsByCategoryID($id);
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">

<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <?php 
require 'utils/styles.php';
?>
        <?php 
require 'utils/scripts.php';