示例#1
0
    $a[1] = $_POST['nombre'];
    $a[2] = $_POST['valor'];
    include_once '../controller/class_tipo_calle.php';
    include_once 'validacion/validaciones.php';
    if (estaVacio($a[1])) {
        echo "<script>alert('Debe ingresar un nombre para el tipo de calle.')</script>";
        echo "<script>window.open('tipo_calle.php','_self')</script>";
        return;
    }
    if (estaVacio($a[2])) {
        echo "<script>alert('Debe ingresar un valor para el tipo de calle.')</script>";
        echo "<script>window.open('tipo_calle.php','_self')</script>";
        return;
    }
    $tipo_calle = new TipoCalle();
    if ($tipo_calle->updateTipoCalle($id, $a)) {
        echo "<script>alert('Se ha modificado correctamente el tipo de calle')</script>";
        echo "<script>window.open('tipo_calle.php','_self')</script>";
    } else {
        echo "<script>alert('Se ha generado un problema al modificar el tipo de calle.\n\t\tid=" . $id . "')</script>";
        echo "<script>window.open('tipo_calle.php','_self')</script>";
    }
}
if ($_GET['accion'] == 'modificar') {
    include_once '../controller/class_tipo_calle.php';
    $tipo_calle = new TipoCalle();
    $id = $_GET['id'];
    $r = $tipo_calle->getTipoCalleById($id);
    $fila = mysql_fetch_object($r);
    $nombre = $fila->nombre;
    $valor = $fila->valor;