If I call setcookie()
two times with the same cookie name, I get two cookies created.
How do you update an existing cookie?
You can update a cookie value using setcookie() function, but you should add '/' in the 4th argument which is the 'path' argument, to prevent creating another cookie with the same name.
i.e. setcookie('cookie_name', 'cookie_value', $exp_date, '/');