Possible Duplicate:
PHP: “Notice: Undefined variable” and “Notice: Undefined index”
I just have a quick question about an error I received when I attempted to set and retrieve value of a cookie in PHP.
From this site and others, the following codes are the ones I am using to achieve this:
<?php
setcookie("edgeUser", $_POST['userName'], time()+0);
echo $_COOKIE['edgeUser'];
?>
From what I understand, this will set a cookie with name="edgeUser", value="$userName" (which is provided from another page that is HTML), and will expire the moment that the user closes the session.
However, when I did run this, I got an error that apparently occurred on the "echo" line:
Notice: Undefined index: edgeUser in C:\wamp\www\Login2.php on line **
Am I supposed to define "edgeUser" somewhere else in the code? I attempted to look into this, however, I either didn't see or didn't understand what else I am supposed to do. Any help would be greatly appreciated!