# are you assigning a constant here?
$_SESSION[cook_name] = cookie;
# did you mean:
$_SESSION[cook_name] = 'cookie';
# this will not work:
setcookie ('$_SESSION[cook_name]', 'yes');
# you need to get rid of the single quotes.
setcookie ($_SESSION['cook_name'], 'yes');