Forum PHP 2017

Voting

Please answer this simple SPAM challenge: nine minus two?
(Example: nine)

The Note You're Voting On

Tugrul
2 years ago
Setting new cookie
=============================
<?php
setcookie
("name","value",time()+$int);
/*name is your cookie's name
value is cookie's value
$int is time of cookie expires*/
?>

Getting Cookie
=============================
<?php
echo $_COOKIE["your cookie name"];
?>

Updating Cookie
=============================
<?php
setcookie
("color","red");
echo
$_COOKIE["color"];
/*color is red*/
/* your codes and functions*/
setcookie("color","blue");
echo
$_COOKIE["color"];
/*new color is blue*/
?>

Deleting Cookie
==============================
<?php
unset($_COOKIE["yourcookie"]);
/*Or*/
setcookie("yourcookie","yourvalue",time()-1);
/*it expired so it's deleted*/
?>

Reference: http://gencbilgin.net/php-cookie-kullanimi.html

<< Back to user notes page

To Top