Hi,
url - www.chaprak.com
path - /articles.php
query - cat_id=6
For more information click here.
Hi,
Now you have learnt to set a cookie in php. Now the next thing is to retrieve the value stored in cookie.
With the following code you can retrieve the value stored in cookie.
To get the value stored in cookie we are using global variable $_COOKIE.
Here we are getting the value stored in cookie to the variable $mycookie.
Here is full code to check & print the value of the cookie.
Hi,
You might be searching for how to set a raw cookie in php. So here is a simple example which shows how to set a raw cookie.
To set a cookie use the function "setrawcookie"
setrawcookie() is exactly the same as setcookie() except that the cookie value will not be automatically urlencoded when sent to the browser.
This function accepts different number of arguments or parameters as setcookie. You can see the php reference manual of setcookie function here for more details.
In the following example we are passing 3 parameters
1) cookie name - its the name by which cookie will be identified.
2) cookie value - its the value stored in cookie.
3) expiration time - the time till the cookie will be available, after that it will be destroyed.
You can set the cookie by using above function.
more details can be found here.
You might be searching for how to set a cookie in php. So here is a simple example which shows how to set a cookie.
To set a cookie use the function "setcookie"
Note that the value portion of the cookie will automatically be urlencoded when you send the cookie, and when it is received, it is automatically decoded and assigned to a variable by the same name as the cookie name.
This function accepts different number of arguments or parameters. You can see the php reference manual of setcookie function here for more details.
In the following example we are passing 3 parameters
1) cookie name - its the name by which cookie will be identified.
2) cookie value - its the value stored in cookie.
3) expiration time - the time till the cookie will be available, after that it will be destroyed.
You can set the cookie by using above function.
more details can be found here for more details.