Monday, November 21, 2011

PHP: Setting and Reading Cookies



<?PHP

setcookie("myCookieName", "myCookieValue");

// To read cookie, simply retrieve from the $_COOKIE['myCookieNameToRead']

.
.
.


?>


<HTML>
.
.



IMPORTANT: Make sure your <PHP is the first thing is your PHP file. Even a single tiny white space character prior to <PHP will also render the cookie operation useless.

No comments:

Post a Comment