예제 #1
0
        } else {
            if ($_POST["fecha_re"] < $_POST["fecha_cre"]) {
                $errores["fecha_re"] = "El campo Fecha de realización no puede ser menor que la fecha de creación <br>";
                $Error = true;
            }
        }
        echo 'errores comprobados';
        if ($Error) {
            echo 'hay errores';
            include 'Vistas/formulario_practica.php';
        } else {
            echo 'no hay errores';
            include 'modelo.php';
            $tarea = array('nombre' => $_POST['nombre'], 'apellidos' => $_POST['apellidos'], 'descripcion' => $_POST['descripcion'], 'telefono' => $_POST['telefono'], 'email' => $_POST['email'], 'direccion' => $_POST['direccion'], 'poblacion' => $_POST['poblacion'], 'cp' => $_POST['cp'], 'provincias' => $_POST['tbl_provincias_cod'], 'fecha_cre' => $_POST['fecha_cre'], 'operario' => $_POST['operario'], 'fecha_re' => $_POST['fecha_re'], 'an_anterior' => $_POST['an_anterior'], 'an_posterior' => $_POST['an_posterior']);
            print_r($tarea);
            InsertaTarea($tarea);
            echo "bien";
        }
    }
}
/**
 *
 * @param string $name Nombre del campo
 * @param array $opciones Opciones que tiene el select
 * 			clave array=valor option
 * 			valor array=texto option
 * @param string $valorDefecto Valor seleccionado
 * @return string
 */
function CreaSelect($name, $Provincias, $valorDefecto = '')
{
예제 #2
0
        $errores['direccion'] = "Error en el campo Direccion.";
    }
    $o = $_POST['ope'];
    if ($o == "") {
        $HayError = true;
        $errores['ope'] = "Error en el campo Operario.";
    }
    //Campo opcional.
    if (!isset($_POST['anoA'])) {
        $HayError = true;
        $errores['anoA'] = "Error en el campo Anotacion antes de empezar.";
    }
    if (!isset($_POST['tlf']) || !preg_match($patronTLF, $_POST['tlf'])) {
        $HayError = true;
        $errores['tlf'] = "Error en el campo telefono.";
    }
    if (!isset($_POST['CP']) || !preg_match($patronCP, $_POST['CP'])) {
        $HayError = true;
        $errores['CP'] = "Error en el campo Codigo postal.";
    }
    $fecha = TransformarFecha($_POST['fecha_f']);
    //creamos un array con los campos recogidos y filtrados para su inserccion.
    $campos = CreaArrayTareas($_POST['Descr'], $_POST['nombre'], $_POST['tlf'], $fecha, $_POST['correo'], $_POST['ESTADO'], $_POST['Pobla'], $_POST['CP'], $_POST['direccion'], $_POST['provincia'], $_POST['anoA'], "", $_POST['ope']);
    //conectamos con la base de datos y Insertamos el registro.
    if ($HayError) {
        include_once "\\..\\View\\form_insert.php";
    } else {
        InsertaTarea($campos);
        include VIEW_PATH . "insertado.php";
    }
}