PHP - PHP & Cookies

 
Vista:

PHP & Cookies

Publicado por Manuel (1 intervención) el 16/11/2005 18:27:57
Estoy aprendiendo y me he quedado atascado con las galletitas. A ver si alguien me hecha una mano. Tengo el siguiente código:

<?php
setcookie("toma_galleta",$nombre,time()+86400);
?>

<html>

<body>

<form action="index.php" method="POST">

<br>
Nombre:
<br>
<input type="text" name="nombre">

<br>
<input type="submit" value="Enviar">

</form>
<br><br><br>

Hola!

<?
if (isset ($_COOKIE["toma_galleta"]) )
{
echo $_COOKIE["toma_galleta"];
}
else
{
echo " invitado";
}

?>

</body>
</html>

Y al ejecutarlo me da el siguiente error:

Notice: Undefined variable: nombre in c:\archivos de programa\easyphp1-8\www\pruebas\cookies\index.php on line 2

Warning: Cannot modify header information - headers already sent by (output started at c:\archivos de programa\easyphp1-8\www\pruebas\cookies\index.php:1) in c:\archivos de programa\easyphp1-8\www\pruebas\cookies\index.php on line 2


Tengo el easy php. Muchas gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:PHP & Cookies

Publicado por Mauricio (8 intervenciones) el 11/05/2006 23:03:27
Ya intentaste con $_POST["nombre"]....?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar