Ver Mensaje Individual
  #4 (permalink)  
Antiguo 19/06/2007, 14:00
Avatar de lilith_sr
lilith_sr
 
Fecha de Ingreso: enero-2007
Ubicación: México
Mensajes: 113
Antigüedad: 17 años, 3 meses
Puntos: 2
Re: validar un campo de texto

hola talves esto te sirva:
if(ereg('[^A-Za-zñÑ]',$campo_uno))

Código PHP:
<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php

if (!$_POST){
?>
<form method="post" action="archivo.php">
<input name="campo_uno" value="<?=$campo_uno?>" type="text"/>
<input type="submit" name="boton" value="Enviar">
</form>
<?php
}
else
{
   if(
ereg('[^A-Za-zñÑ]',$campo_uno)) 
   { 
     echo 
'error : el campo solo debe contener letras';

    echo 
'<a href="archivo.php">Regresar</a>';
   }
   else
  {
      echo 
'validacion correcta';
  }
}
?>

</body>
</html>

Última edición por lilith_sr; 19/06/2007 a las 14:06