<?php

include "valida.php";
define('AT_INCLUDE_PATH', 'include/');
include_once AT_INCLUDE_PATH . 'funciones_bd.php';
if (!isset($_POST['fase']) || !isset($_POST['paso']) || !isset($_POST['num_pregs']) || !isset($_POST['num_aprobar'])) {
    header("location: definequantities.php?error=1");
} elseif ($_POST["fase"] == "" || $_POST["paso"] == "" || $_POST["num_pregs"] == "" || $_POST["num_aprobar"] == "") {
    header("location: definequantities.php?error=2");
} else {
    $id_paso = $_POST['paso'];
    $id_fase = $_POST['fase'];
    $num_pregs = $_POST['num_pregs'];
    $num_aprobad = $_POST['num_aprobar'];
    $db_control = new funciones_BD();
    if ($db_control->insertQuantitiesPaso($id_paso, $id_fase, $num_pregs, $num_aprobad)) {
        header("location: definequantities.php?conf=1");
    } else {
        header("location: definequantities.php?error=3");
    }
}