Php set, get and delete cookies.
In PHP, cookies are used to store some data on the client side that can be accessed and manipulated by the server side. Cookies commonly store user preferences, login information, and shopping cart items.
SET COOKIES
<?php
$cookie_name = "feedcook";
$cookie_value = "DIPANKAR";
setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/");
?>
name: The name of the cookie.
value: The value of the cookie.
expire: The expiration time of the cookie (in seconds). If this parameter is not specified, the cookie will expire when the browser is closed.
GET COOKIES
<?php
if(isset($_COOKIE['feedcook'])) {
echo "Value is: " . $_COOKIE['feedcook'];
}
?>
DELETE COOKIES
<?php
if(isset($_COOKIE['feedcook'])):
setcookie('feedcook', '', time()-7000000, '/');
endif;
?>
Today we will learn how to verify email id while signup. it's very important for the real user. You ..
This is a common problem for those of you who are new to coding. While coding we often make some syn..
Warning: session start() [function.session-start]: Cannot send session cache limiter - headers alrea..
Before we use the PDO, we will know why we will use PDO.PDO Only supports object-oriented.It has man..
Deprecated: autoload() is deprecated, use spl autoload register() instead. How to replace this (my a..
getimagesize() is a PHP function that returns an array containing information about the size and typ..
Today we will know - How to login with otp in php. Here we will use php,mysql & ajax. Before tha..
Get the latest news and updates by signing up to our daily newsletter.We won't sell your email or spam you !