Ver Mensaje Individual
  #7 (permalink)  
Antiguo 17/02/2011, 11:44
alex885
 
Fecha de Ingreso: febrero-2011
Ubicación: Kolumbien
Mensajes: 5
Antigüedad: 14 años
Puntos: 0
Exclamación Respuesta: validar numeros en php.

ya hice una prueba y me funciono, pero me muestra este error.

Notice: Undefined variable: fecha in D:\wamp\www\PROYECTO\prueba.php on line 13

y el codigo es este:
Código PHP:
Ver original
  1. <html>
  2. <head>
  3. <title>Untitled</title>
  4. </head>
  5. <body>
  6. <form name="formulario" action="" method="post">
  7. diga el numero
  8. <input type="text" name="fecha" />
  9. <input type="submit" value="verifica" /></form>
  10. <?
  11. if (is_numeric($fecha) && ($fecha)< 2011)
  12.  {
  13.  echo "Yes es un numero, sumerced";
  14.  }
  15.  else {
  16.  echo "No";
  17.  }
  18.  ?>
  19. </body>
  20. </html>

lo que me imagino es que $fecha no tiene variable asignada.
como hago para asignar a $fecha la variable name=fecha.? para que asi no me salga el error.