PHP Cookies The setcookie() function is used to set a cookie. Note: The setcookie() function must appear BEFORE the tag. setcookie(name, value, expire, path, domain); <?php setcookie("user", "Alex Porter", time()+3600); ?> <html> ... <?php setcookie("user", "Tanya", time()+3600); ?> <!DOCTYPE HT...