Retrieving data from a cookie

Hello.

I have a problem with using a cookie in Flash and I need some help. I don’t know too much about cookies so I am looking forward to your help.

What I need is to retrieve the username from a cookie into Flash. I am using LoadVars to communicate with a PHP file that will echo the username.

The problem is with the PHP file that should output the username from the cookie.

Here is the simple PHP code that I have tried:


$user = $_SESSION['username'];
echo "user=".$user;

I have also tried the following:


$user = $_COOKIE['username'];
echo "user=".$user;

Are any of these correct ? Is there anything else that I need to do ? I am sure that it is something rather simple in the end.

Again, what the PHP code needs to do is retrieve the username with the id of “username” from a cookie.

Thank you.