Let me guess, the whole code is something like:
<?php
if (isset($_GET['referrer_id'])) {
setcookie('NextCoupons_Referrer',$_GET['referrer_id'], time()+3600*24);
echo 'Cookie: ' . $_COOKIE['NextCoupons_Referrer'];
} else {
echo 'No referrer id.';
}
?>
If you read the PHP manual on [man]setcookie/man, you will find that it states: "Once the cookies have been set, they can be accessed on the next page load with the $_COOKIE or $HTTP_COOKIE_VARS arrays." and "Cookies will not become visible until the next loading of a page that the cookie should be visible for. To test if a cookie was successfully set, check for the cookie on a next loading page before the cookie expires." (Emphasis mine.)
If I got it wrong, then you've been wasting our time. Post the smallest and simplest code that demonstrates the problem. Code snippets are good, but they often fail to provide a complete picture of the problem.