without doing a redirect after setting a cookie, I don't know of a reliable way to do so.
Basically something like:
index.php
<?php
setcookie ('cookied','yes')
header('Location: cookietest.php');
?>
cookietest.php
<?php
if ($_COOKIE['cookied']) {
print "I've got your warm gooey chocolate chip cookie right here";
}
?>
There are other methods, this one is pretty much tried and true. That is consquently the behavior that got one of my web sites banned from google for two years
There might be errors in the code, I didn't test it, but, it should be pretty darn close.