
18/11/2015, 21:41
|
| | Fecha de Ingreso: noviembre-2010
Mensajes: 47
Antigüedad: 14 años, 3 meses Puntos: 1 | |
porqué no funciona variable session Tengo un formulario el cual mediante variable de sesion necesito guardar su valor, el caso es que la mando a imprimir para ver si obtiene valores y me sale el siguiente error:
Nota: al action no llama archivo externo ya que necesito usar variable en este mismo form
Undefined index: txtusuario in C:\wamp\www\variables.php on line 3
<?php
session_start(); //Iniciamos la sesion
$_SESSION['nombre'] = $_POST['txtusuario']; // aqui marca error
?>
<html>
<head>
</head>
<body>
<form action="" method="post">
Escribe tu Nickname:
<input type="text" size="25" name="txtusuario" />
<br />
<input type="submit" value="Grabar" name="subir" />
<?php
if (isset($_POST['subir'])) {
echo "escribiste :".$_SESSION['nombre'];
}
?>
</form>
</body>
</html> |