<?php

include "../ReglasNegocio/tipo_obra.php";
$codigo_tipo_obra = $_POST["codigo_tipo_obra"];
$nombre_tipo_obra = $_POST["nombre_tipo_obra"];
$hd_variable = $_POST["hd_variable"];
$id_variable = $_POST["id_variable"];
//echo $hd_variable."<br>";
$address = new tipo_obra();
if (empty($codigo_tipo_obra)) {
    header("Location: paso.php?c=v");
} elseif ($hd_variable == "ingresar") {
    $value = $address->Select2($codigo_tipo_obra);
    if (empty($value)) {
        $value = $address->Add($codigo_tipo_obra, $nombre_tipo_obra);
    }
    header("Location: paso.php?c=v");
} elseif ($hd_variable == "editar") {
    $value = $address->Update($id_variable, $codigo_tipo_obra, $nombre_tipo_obra);
    header("Location: paso.php?c=v");
    //echo "edicion";
}