Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/10/2009, 19:49
GabrielTorres
 
Fecha de Ingreso: octubre-2009
Mensajes: 7
Antigüedad: 14 años, 6 meses
Puntos: 0
Duda con get y post

Hola, siguiendo con el manual de PHP del wiki, donde copié TEXTUALMENTE esto:

formulario.php
<head>
<title>Formulario</title>
</head>
<body>

<form action="programa.php" method="get" id=”formulario” name=”formulario”>
Nombre: <input type="text" name="nombre" id="nombre" />
Edad: <input type="text" name="edad" id="edad" />
<input type="submit" value="enviar" name="enviar" id="enviar" />
</form>

</body>
</html>

y otro

programa.php
<html>
<body>

Bienvenido <?php echo $_GET['nombre'];?>. <br />
Tu edad es: <?php echo $_GET['edad'];?> años.

</body>
</html>

Lo cual funcionó correctamente, pero despues quise usar el ejemplo del POST

formulario.php
<html>
<body>

<form action="programa.php" method="post" id=”formulario”>
Nombre: <input type="text" name="nombre" />
Edad: <input type="text" name="edad" />
<input type="submit" />
</form>

</body>
</html>

programa.php
<html>
<body>

Bienvenido <?php echo $_POST["nombre"]; ?>,<br />
Tu edad es: <?php echo $_POST["edad"]; ?> años.

</body>
</html>

y sólo me devuelve:
Bienvenido .
Tu edad es: años.

O sea, ni el campo nombre ni el campo edad aunque no da ningun error.

Que es lo que esta mal?