I\'m trying to access a cookie\'s value (using $_COOKIE) immediately after calling the setcookie() function in PHP. When I do so, $_COOKIE[\
$_COOKIE
setcookie()
$_COOKIE[\
Using ob_start() and ob_flush() you can send the cookie to client and retrieve it in the same run time. Try this:
ob_start(); setcookie('uname', $uname, time() + 60 * 30); ob_flush(); echo "Cookie value: " . $_COOKIE['uname'];