I am trying to do a very simple thing, which is fill in a login form (username and password) and store the username in a cookie. I would then like to retrieve and display the username on the page. The form posts back to the same page.
In the file header I have the following (I had a printf statement in the code to check that $value exists and it does):
if ($_POST["username"]) {
$value = $_POST["username"];
setcookie("un", $value, (time()+3600*24)*7);
}
In the body of the file I have:
printf($_COOKIE["un"]);
Nothing prints.
As always, your help would be much appreciated.

