Ec (2); what is cookie? Cookies are often used to identify users. Cookie is a small file that the server stays on the user's computer. When the same computer requests a page through a browser, it sends a cookie at the same time. Through the php tutorial, you can create and retrieve the cookie value. How to Create a cookie? The setcookie () function is used to set the cookie. Note: The setcookie () function must be located in & lt; html & gt; script ec (2); script
What is cookie?
Cookies are often used to identify users. Cookie is a small file that the server stays on the user's computer. When the same computer requests a page through a browser, it sends a cookie at the same time. Through the php tutorial, you can create and retrieve the cookie value.
How to Create a cookie?
The setcookie () function is used to set the cookie.
Note: The setcookie () function must be locatedBefore the tag.
Syntax
Setcookie (name, value, expire, path, domain );
Function cookie ($ var, $ value = '', $ time = 0, $ path ='', $ domain = ''){
$ _ Cookie [$ var] = $ value;
If (is_array ($ value )){
Foreach ($ value as $ k => $ v ){
Setcookie ($ var. '['. $ k. ']', $ v, $ time, $ path, $ domain, $ s );
}
} Else {
Setcookie ($ var, $ value, $ time, $ path, $ domain, $ s );
}
What if the browser does not support cookies?
If your application involves a browser that does not support cookies, you have to use other methods to pass information from one page to another in the application. One way is to pass data from the form (the content about the form and user input is described earlier in this tutorial ).
The following form submits user input to "welcome. php" when the user clicks the submit button:
Retrieve the value in "welcome. php" as follows:
Welcome .
You are Years old.