Ver Mensaje Individual
  #3 (permalink)  
Antiguo 07/07/2010, 16:11
Avatar de dcreate
dcreate
 
Fecha de Ingreso: octubre-2009
Ubicación: Veracruz
Mensajes: 536
Antigüedad: 14 años, 7 meses
Puntos: 22
Respuesta: Validar campos de formulario

bueno yo lo hago con javascript, un ejemplo basico:

Código PHP:
<html>
<
head>
<
script>
function 
validar(formulario)
{
if(
formulario.nombre.value=='')
{
alert("LLENAR CAMPOS NECESARIOS\n-NOMBRE");
formulario.nombre.focus();
return 
false;
}
if(
formulario.edad.value=='')
{
alert("LLENAR CAMPOS NECESARIOS\n-EDAD");
formulario.edad.focus();
return 
false;
}
return 
true;
}
</script>
</head>

<body>
<form method="post" action="otra.php" onsubmit="">
nombre: <input typoe="text" name="nombre">
edad: <input type="text" name="edad">
<input type="submit" name="enviar" value="enviar">
</form>
</body>
</html> 
espero te sirva
__________________
Somos lo que pensamos, como pensamos vivimos.