learning teh PHP, cookie help
alright, im learning the basics of php, and im trying out cookies ;)
so far, i have this:
Code:
<?php
setcookie("fname", name, 60);
?>
<html>
<body>
<center>
<title>loltest</title>
<form action="phpcookieform.php" method="post">
Name: <input type="text" name="name" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>
<?php
if (isset($_COOKIE["fname"]))
echo "Hello" . $_COOKIE["fname"] . "!<br />";
else
echo "Hello Guest!"; ?>
</center>
</body>
</html>
the problem is it either doesnt save the cookie, or it doesnt load it correctly
it should be self explanitory, a form tells you to put in your name, and it saves it to a cookie. then it should echo your name, when ever you go to the page( i believe ). i also read a tut somewhere saying that saving the cookie should be above all HTML tabs, it seems to work because i got an error when i didnt. im a noob at this so it should be very obvious :p.
and if your wondering, the web page is here
thanks