Hola
Adler, gracias por contestar.
He intentado probar el código que me has indicado, pero no doy con ello. Perdona mi ignorancia, pero realmente es que no sé dónde ponerlo exactamente para que funcione. Bueno, en realidad sí que he conseguido que no se guarden los datos del formulario si se sobrepasa la fecha límite, pero el mensaje de "Límite pasado" se carga desde el inicio con el resto de la página... vamos, una chapuza que no vale.
Pongo el código de un formulario de ejemplo por si alguien me puede echar una mano. Es muy simple: nombre, apellidos y el botón Enviar. Lo he realizado con Dreamweaver.
Código PHP:
Ver original<?php require_once('Connections/basedatos.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
}
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ?
intval($theValue) : "NULL"; break;
case "double":
$theValue = ($theValue != "") ?
doubleval($theValue) : "NULL"; break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); }
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "formulario1")) { $insertSQL = sprintf("INSERT INTO bdprueba (nombre, apellido1, apellido2) VALUES (%s, %s, %s)", GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['apellido1'], "text"),
GetSQLValueString($_POST['apellido2'], "text"));
$insertGoTo = "inicio.php";
if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ?
"&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING'];
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>prueba2</title>
</head>
<body>
<form id="formulario1" name="formulario1" method="POST" action="<?php echo $editFormAction; ?>">
<p>
<label>Nombre
<input type="text" name="nombre" id="nombre" />
</label>
</p>
<p>
<label>Apellido 1
<input type="text" name="apellido1" id="apellido1" />
</label>
</p>
<p>
<label>Apellido 2
<input type="text" name="apellido2" id="apellido2" />
</label>
</p>
<p>
<label>
<input type="submit" name="enviar" id="enviar" value="Enviar" />
</label>
</p>
<input type="hidden" name="MM_insert" value="formulario1" />
</form>
</body>
</html>
Saludos.