Creating a Cookie
To create a cookie, the PHP function setcookie() can be used. It expects the following parameters; however, only the first one is mandatory:
The preceding code sets a simple session cookie with the current PHP version as its value. Figure 5.2 shows a cookie warning in the Firefox browser. You can clearly see the cookie name and script. Figure 5.2. Firefox receives the cookie and asks the user what to do. |