$_COOKIE shows the value of the cookie at the time the user requested the page.
Before the the cookie gets made, $COOKIE is null. You have set the cookie in your code, but $COOKIE retains it value (NULL).
The next time your user requests a page, $_COOKIE will have the value you set.
$_COOKIE doesn't update on the fly, only at the time the page request hits the server.