<?php
require_once('../../includes/functions.php');
checkSession();

try {
    $connection = getDbConnection();
    $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $prepare = $connection->prepare("DELETE FROM modello WHERE codice = ?;");
    $prepare->bindParam(1, $_POST['codice']);

    try {
        $prepare->execute();
    } catch (PDOException $e) {
        echo "Impossibile inserire il modello, controllare i dati";
        die($e->getMessage());
    }

} catch (PDOException $e) {
    die("Error: " . $e->getMessage());
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login</title>
    <link rel="stylesheet" href="../../includes/css/pico.min.css">
</head>
<body>
    <main class="container">
        <a href="../dashboard.php" class="button">Torna alla dashboard</a>
        <h2>Operazione eseguita con successo</h2>
    </main>
</body>
</html>
