<?php
require_once('../Connections/cmctrfdb.php');
require_once('../webassist/mysqli/rsobj.php');

if (isset($_GET['idtd']) && !empty($_GET['idtd'])) {
    $idtd = $_GET['idtd'];

    // Query per aggiornare statustd a "Revision" e impostare signnametd e signedontd a NULL
    $updateSQL = "UPDATE data_td SET statustd = 'Revision', signnametd = NULL, signedontd = NULL WHERE iddata_td = ?";

    $stmt = $cmctrfdb->prepare($updateSQL);
    $stmt->bind_param("i", $idtd);
    $stmt->execute();
    $stmt->close();

    // Reindirizza a cstd.php senza variabili
    header("Location: cstd.php");
    exit();
} else {
    // Reindirizza a cstd.php in caso di ID non valido
    header("Location: cstd.php");
    exit();
}
