Francesco Curletti
Francesco Curletti

Reputation: 13

Add 10 minutes expired time on cookie in php

i have this command line in php for set a cookie.

        document.cookie="<?php echo $_POST["setcookie"]; ?>"+"domain=.adidas.it;path=/";

I want to add 10 minutes expired time, who can help me? thanks

Upvotes: 0

Views: 4163

Answers (1)

Mazz
Mazz

Reputation: 1879

There is a PHP function to set a cookie

setcookie ( string $name [, string $value [, int $expire = 0 [, string $path [, string $domain [, bool $secure = false [, bool $httponly = false ]]]]]] )

In your case

$name = "yourname";
$value = "yourvalue";
$expire = time() + (60*10);
$domain = ".adidas.it";
$path = "/";
setcookie($name,$value,$expire,$path,$domain);

Upvotes: 1

Related Questions