Tuesday, November 15, 2022

How to Use Cookies in PHP Web Application Basic

 How to Use Cookies in PHP Web Application Basic




// Set Cookie in browser and get its value

$name = 'AnilSahu';
$value = 200;
$exp = time() + (60 * 60 * 24 * 7 * 4 * 12);


setcookie($name, $value, $exp);


if (isset($_COOKIE['AnilSahu'])) {
$name = $_COOKIE['AnilSahu'];
echo $name;
} else {

$name = '';
}

0 comments

Post a Comment