<?php
include 'db.php';

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $Id = $_POST['Id'];
    $Diagnostico = $_POST['Diagnostico'];
    $Componente = $_POST['Componente']; // This will now come from a <select> with values 'SI' or 'NO'
    $Actividad = $_POST['Actividad'];
    $Estatus = $_POST['Estatus'];
    $Ejecuto = $_POST['Ejecuto'];
    $Verifico = $_POST['Verifico'];
    $Recibio = $_POST['Recibio'];
$Observacion = $_POST['Observacion'];

    $sql = "UPDATE mcorrect SET 
                Diagnostico = ?,
                Componente = ?,
                Actividad = ?,
Observacion = ?,
                Estatus = ?,
                Ejecuto = ?,
                Verifico = ?,
                Recibio = ?
            WHERE Id = ?";

    $stmt = $conexion->prepare($sql);
$stmt->bind_param("ssssssssi", $Diagnostico, $Componente, $Actividad, $Observacion, $Estatus, $Ejecuto, $Verifico, $Recibio, $Id);

    if ($stmt->execute()) {
        echo "<script>alert('Registro actualizado correctamente'); window.location='filtro_reportes.php';</script>";
    } else {
        echo "Error al actualizar el registro: " . $conexion->error;
    }

    $stmt->close();
    $conexion->close();
}
?>
