Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/11/2015, 22:06
Avatar de gonzaherrera77
gonzaherrera77
 
Fecha de Ingreso: noviembre-2015
Mensajes: 60
Antigüedad: 8 años, 6 meses
Puntos: 7
Respuesta: porqué no funciona variable session

Buenas proba así

Código PHP:
Ver original
  1. <?php
  2.  
  3. session_start(); //Iniciamos la sesion
  4. if(isset($_POST['txtusuario'])) {
  5.    $_SESSION['nombre'] = $_POST['txtusuario'];
  6. }
  7.  
  8.  
  9.  
  10. ?>
  11. <html>
  12.    <head>
  13.    </head>
  14.    <body>
  15.       <form action="form.php" method="post">
  16.          Escribe tu Nickname:
  17.          <input type="text" size="25" name="txtusuario" />
  18.          <br />
  19.          <input type="submit" value="Grabar" name="subir" />
  20. <?php
  21.  
  22. if (isset($_POST['subir'])) {
  23. echo "escribiste :".$_SESSION['nombre'];
  24. }
  25.  
  26. ?>
  27.       </form>
  28.    </body>
  29. </html>

¡Saludos!

Última edición por gonzaherrera77; 18/11/2015 a las 22:20