<?php
require_once '../config/database.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $name = $_POST['name'];
    $unit = $_POST['unit'];
    $price = $_POST['price_per_unit'];
    $stock = $_POST['stock_qty'];
    $min = $_POST['min_stock_level'];

    $stmt = $pdo->prepare("INSERT INTO ingredients (name, unit, price_per_unit, stock_qty, min_stock_level) VALUES (?, ?, ?, ?, ?)");
    $stmt->execute([$name, $unit, $price, $stock, $min]);

    header("Location: ../modules/admin/dashboard.php?status=bahan_ok");
}