← Foro de PHP

sesiones que no me funciona

Hilo en el foro de PHP · 08 de Enero del 2004 · 2 respuestas
Fede08 de Enero del 2004
Pregunta
hice una pagina bien simple pero no anda... teoricamente cuando aprete el boton me tendria que imprimir el contenido de $variable, pero no lo hace
cual es mi error... gracias


<?php session_start(); ?>
<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php


session_register("variable");

echo $variable;

if(isset($_POST["boton"]))
{
$variable=$_POST["valor"];
}

?>
<form name="form1" method="post" action="">
<input name="valor" type="text" id="valor">
<input name="boton" type="submit" id="boton" value="Enviar">
</form>
</body>
</html>


_______________________________________________
Lista de correo [email protected]
http://www.espaciolibre.net/cgi-bin/listinfo/uylug-linux

Respuestas 2

cl08 de Enero del 2004
Prueba con este código.

Suerte!

<?php session_start(); ?>
<html>
<head>
<title>Documento sin título</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php
if(isset($_POST["boton"]))
{
$variable=$_POST["valor"];
}
session_register("variable");
echo "$variable";

?>
<form name="form1" method="post" action="">
<input name="valor" type="text" id="valor">
<input name="boton" type="submit" id="boton" value="Enviar">
</form>
</body>
</html>
cl08 de Enero del 2004
Las barras las agrega, al parecer, de forma automática el servidor al postear el código, debes eliminarlas.
¿Buscas más hilos como este? Mira el foro de PHP o usa el buscador.