Well by the looks of it your setting the cookie after checking for it...
I'm not positive here but it looks like the first time you load the page theres no cookie, as soon as it tells you that however the PHP script reaches the setcookie command, sets the cookie, so when you load it again it IS set...
What are you trying to use them for?
To check they work I'd just write a two test pages...
setcookie.php
<?
setcookie('MrCookie', 'value');
?>
checkcookie.php
<?
if (isset($MrCookie)) {
echo "Cookies working!";
}
?>
Hope that helps