Help with setting cookie

I have a simple test page to set a cookie and then determine if it was set.

It’s not setting the cookie:

if(!isset($_COOKIE["CMS"])) { 
	$domain = ($_SERVER['HTTP_HOST'] != 'localhost') ? $_SERVER['HTTP_HOST'] : false;
	setcookie("CMS", $email, time()+3600, '/', $domain, false);
	$_COOKIE["CMS"] = "test";
	echo"Cookie not set / ";
	echo $_COOKIE['CMS'];
	echo"cookie is set";


Dont know if it makes a difference but its on a subdomain of
And this is the entire page code - no headers, etc.

Sponsor our Newsletter | Privacy Policy | Terms of Service