The value/variable that you used to set the cookie is available anywhere on that page, just use that value.
PHP Code:
if(!isset($_COOKIE['TestCookie'])){
$cookie_value = 'something from somewhere';
setcookie("TestCookie", $cookie_value, time()+3600);
// more code ....
if($cookie_value == 'something from somewhere'){
...
}
} // end of !isset cookie...
If you have a single web page that has logic to both set a cookie and logic that makes use of that cookie, you can "fake" setting the cookie by adding something like the following after the actual setcookie(...) statement -
PHP Code:
$_COOKIE['TestCookie'] = $cookie_value;
The key for proper logic when a web page both sets and uses a cookie is that it should have conditional logic that determines what to do when the cookie is set and when it is not set.