Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to create cookie in php

// SYNTAX
//setcookie(name, value, expire, path, domain, secure, httponly);
$cookie_name = "LoginUser";
$cookie_value = "ex@gmail.com";
setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); // 86400 = 1 day
if(!isset($_COOKIE[$cookie_name])) {
  echo "Cookie '" . $cookie_name . "' is not set!";
} else {
  echo "Cookie '" . $cookie_name . "' is set!<br>";
  echo "Value is: " . $_COOKIE[$cookie_name];
}
// FOR UNSET COOCKIE
 unset($_COOKIE['LoginUser']);
Comment

php cookie

setcookie ('name', 'value', $expiresOn, $path, $domain, $secure, $httponly)
Comment

cookies php syntax

setcookie("cookie_name", "type_on_cookie", expiry_time(), "/");
Comment

PHP Cookies

<?php
$cookie_name = "user";
$cookie_value = "John Doe";
setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); // 86400 = 1 day
?>
<html>
<body>

<?php
if(!isset($_COOKIE[$cookie_name])) {
  echo "Cookie named '" . $cookie_name . "' is not set!";
} else {
  echo "Cookie '" . $cookie_name . "' is set!<br>";
  echo "Value is: " . $_COOKIE[$cookie_name];
}
?>

</body>
</html>
Comment

php cookies

setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); // 86400 = 1 day
Comment

PREVIOUS NEXT
Code Example
Php :: laravel global scope 
Php :: php timestamp to seconds 
Php :: import storage laravel 
Php :: how to use php to print inside html 
Php :: set postman global variable header 
Php :: how to install symfony in windows 10 
Php :: how to do a submit button in php without reloading the page 
Php :: check if array contains only unique values php 
Php :: belongs to many laravel 
Php :: php strict mode 
Php :: php loop 100 times 
Php :: apache2 php 8 update not working 
Php :: PHP filter_var() Function 
Php :: readfile in php 
Php :: mac brew install php redis 
Php :: laravel controller in details 
Php :: php remove control characters from string 
Php :: laravel multiple paginate 
Php :: how to get index 2nd php 
Php :: how to log object laravel logger 
Php :: Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1 
Php :: woocommerce order item get product id 
Php :: array key value php 
Php :: laravel check environment hlper 
Php :: array_filter first element php 
Php :: Laravel stop on first validation error 
Php :: laravel get from model first 
Php :: laravel route param blade 
Php :: laravel validation custom message 
Php :: how to download image from url from a particular div in php 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =