function veriForm() { $camposObligatorios = array("nombreUsuario", "apellidos"); $camposPendientes = array(); foreach ($camposObligatorios as $campoObligatorio) { if (!isset($_POST[$campoObligatorio]) or !$_POST[$campoObligatorio] or !preg_match("/^[a-zA-Z][a-zA-Z ]+\$/", $_POST[$campoObligatorio])) { $camposPendientes[] = $campoObligatorio; } } if ($camposPendientes) { displayForm($camposPendientes); } else { procesForm(); } }
function veriForm() { $camposObligatorios = array("nombre", "apellidos", "direccion", "telefono", "email"); $camposErroneos = array(); $camposPendientes = array(); foreach ($camposObligatorios as $campoObligatorio) { if ($campoObligatorio == "email") { } else { if (!isset($_POST[$campoObligatorio]) or !$_POST[$campoObligatorio]) { $camposPendientes[] = $campoObligatorio; } } } if ($camposPendientes) { displayForm($camposPendientes); } else { procesForm(); } }
/* * Autor= Javi * Fecha= 18-nov-2015 * Licencia= default * Version= Expression version is undefined on line 10, column 14 in Templates/Scripting/EmptyPHP.php. * Descripcion= * / /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ ?> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <?php $fotos = array("foto1", "foto2", "foto3"); require_once "funcionesEjer6.php"; if (isset($_POST["enviarFoto"])) { procesForm($fotos); } else { displayForm($fotos); } ?> </body> </html>
<!-- /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * Autor= Javi * Fecha= 30-oct-2015 * Licencia= default * Version= Expression version is undefined on line 10, column 14 in Templates/Scripting/EmptyPHP.php. * Descripcion= * / --> <html> <head> <meta charset ="UTF-8" /> <title></title> </head> <body> <?php include_once 'funcionesRelleno.php'; include_once 'funcionesEjer1.php'; if (isset($_POST["enviar"])) { procesForm(); } else { displayForm(array()); } ?> </body> </html>