Answer the question
In order to leave comments, you need to log in
How to write cookies correctly?
I write cookies like this:
$lpg = $_GET['utm'];
setcookie('lpg', $lpg, time()+60*60*24*60); //кука 60 дней
<?php
$lpg = $_GET['utm'];
if(isset($_COOKIE['lpg']) && $_COOKIE['lpg'] != '') { // Если не пустая...
$c = $_COOKIE['lpg']; // ...получить куку...
setcookie('lpg', "$c_$lpg", time()+60*60*24*60); // ...и дописать "_$lpg"
} else { // Если пустая...
setcookie('lpg', $lpg, time()+60*60*24*60); // ...просто заполнить "$lpg"
}
?>
Answer the question
In order to leave comments, you need to log in
Add - no way. You can read the old value and add what you need there, saving it again with the same name.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question