Well ok... lets start with the basics...
I will assume the part of code that is not working is inside the if statement, and that at somepoint you are actually entering the if statement.
Next thing to look at is, do globals get set automaticly on your server, look in the PHP.ini file to see if setglobals = on. You can also check this by looking for your cookie in the $_COOKIE[] or $HTTP_COOKIE_VARS[] arrays. Finally you can put a die(phpinfo()); just after you set your cookie to see if it shows up in the HTTP VARS list.
I am not sure that I have ever tried to set a cooke and then access it on the same page, but the PHPINFO() should tell you if it is there... Cookies may only get read when the page is loaded.
Let me know if this helps
PHPdev