I am writing a new php page and need to determine which user is logged in from the cookie ´usercookie[username]´ . I am using the following code: <?php $currentuser = $_COOKIE["usercookie[username]"]; ?> But it returns nothing, any ideas, is it something to do with the square brackets that are within the cookie name? Thanks in advance.
I know its wierd but that is the name of the cookie when I view it in firefox thats is name usercookie[username]
Try this, $currentuser = $_COOKIE["usercookie['username']"]; Code (markup): If it doesn't work, then I think you will have to get it with two steps. ie $usercookie = $_COOKIE['usercookie']; $username = $usercookie['username']; Code (markup):