Issues with set cookie

If you’re doing this via a theme, add this line to your functions.php file:

function set_user_cookie() {
    $school = "Some Value";
    setcookie('default_school', $school, time()+3600);
}
add_action( 'init', 'set_user_cookie');

To display information add this line

echo $_COOKIE['default_school'];