I’m trying to learn how to make cookies, so i made 3 files: [URL=http://projep.t35.com/phptests/cookie.html]cookie.html
which has a form with the action to go to cookie.php :
[code=php]<?
$name = POST[‘name’];
setcookie(“username”, $name, time()+9999);
?>
<html>
<head>
<title>Cookie set</title>
</head>
<body>
<?
echo ‘The cookie has been set. Click a link on the page to navigate the site.’;
?>
</body>
</html>
and then id change the url to go to cookie2.php:
[code=php]<?php
if (isset($_COOKIE[“username”]))
echo “Welcome ” . $_COOKIE[“username”] . “!<br />”;
else
echo “You are not logged in!<br />”;
?>
however, it doesn’t work at all. what’d i do wrong?