Output $_COOKIE

I can’t understand why the cookie is not displayed, in the browser there is a cookie in the infe of the page, moreover, with a very correct content (pass), but


Do I always get NULL?

if ($user->createUser()){
     $form = $success;
    else $form = $regform;
 case "goodluck": 
 /*    */
 if ($user->checkPass($_COOKIE[email],$_POST["pass"])){
        var_dump("cookie[pass]: ",$_COOKIE["pass"],"<br /><pre>");
        print_r($_COOKIE); echo "</pre>";

Answer 1, authority 100%

Well, there can be several options here:

1) When you created the cookie, you might have created it as “Pass” and you’re trying to read it from the array as “pass”. Case matters!

2) You didn’t refresh the page after you created the cookie. The $_COOKIEarray is not dynamically updated like any other PHP variable.

3) The “var_dump()” function returns information about a variable. Try simply printing the variable to the browser, or debugging the entire array with the print_r()function. Then see if the variable is present in the array at all.

Leave a reply

Please enter your comment!
Please enter your name here