HOW TO SET COOKIES: (to store small pieces of data in CLIENTS browser)
DESCRIPTION:
setcookie(string $name, string $value = "", int $expires = 0 (no expiry) ): bool
EXAMPLE:
$value = 'something from somewhere';
setcookie("TestCookie", $value); // default no expiry
setcookie("TestCookie", $value, time()+3600); /* expire in 1 hour */
// Print an individual cookie value- $_COOKIE["Cookie Key Name"];
echo $_COOKIE["TestCookie"];
// View all cookies
print_r($_COOKIE);
FULL PARAMETER OPTIONS:
setcookie(
string $name,
string $value = "",
int $expires = 0,
string $path = "",
string $domain = "",
bool $secure = false,
bool $httponly = false
): bool
EXAMPLE:
setcookie("TestCookie", $value, time()+3600, "/~rasmus/", "example.com", 1);