Cookies are stored in the browser. They have many uses since they can timeout at certain intervals and contain identifiable names. Programmers may use them to store variable data for usage elsewhere, or for page access.
When a cookie is written to the browser, name, content and the path can be set.
setcookie(“cookie”, “variable_or_text”, time()+ 7200, “/”) can be used in all directories due to the foreward slash “/”
setcookie(“cookie”, “data_output”, time()+ 7200) can be used in the residing directory on the website.
The code below takes a variable($email_address) and uses it as the cookie ‘Content’.
setcookie(“email”, $email_address, time()+ 7200, “/”);
If you echo the cookie in the future like:
value=”<?php echo $_COOKIE[’email’]; ?>” ///the output will be the data_output with a real email address.