0

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

  • 1
    See [How to expire a cookie in 30 minutes using jQuery?](http://stackoverflow.com/a/1830263/4535200) – Qirel Feb 06 '17 at 21:59

1 Answers1

1

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);
Mazz
  • 1,859
  • 26
  • 38