<?php
include('../include/headscript.php');
include('../class/company.php');
$conn = new mysqli($servername, $username, $password, $database);

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $idlab = $_POST['idlab'];

    $stmt = $conn->prepare("DELETE FROM laboratories WHERE idlab = ?");
    $stmt->bind_param("i", $idlab);

    if ($stmt->execute()) {
        echo json_encode(["status" => "success", "message" => "Laboratory deleted successfully."]);
    } else {
        echo json_encode(["status" => "error", "message" => "Failed to delete laboratory."]);
    }
    $stmt->close();
}
$conn->close();
