$uni = $_POST['unidad_med'];
    $pre = $_POST['precio'];
    echo $nom;
    include '../model/productos.php';
    $con = new Productos();
    $result = $con->Nuevo($nom, $uni, $pre);
    if ($result > 0) {
        header('Location: ../views/productosList.php');
    }
}
if (isset($_POST['submit']) && $_POST['submit'] == "Editar") {
    $id = $_POST['idproducto'];
    $nom = $_POST['nom_pro'];
    $uni = $_POST['unidad_med'];
    $pre = $_POST['precio'];
    include '../model/productos.php';
    $con = new Productos();
    $result = $con->Update($id, $cod, $uni, $pre);
    if ($result) {
        header('Location: ../views/productosList.php');
    }
}
if (isset($_GET['action']) and $_GET['action'] == "delete") {
    $id = $_GET['id'];
    include '../model/productos.php';
    $con = new Productos();
    $eliminar = $con->Delete($id);
    if ($eliminar) {
        echo '<script type="text/javascript"> alert("El registro ah sido eliminado"); history.back();</script>';
    }
}