Can't delete php set cookie
Checkout the cookie path.
Since you are not passing the path
parameter to the setcookie
function, in this case the cookie will be set for the current directory only and can be used and can be unset from that directory only.
Possible solution is to pass the path
value as /
. So that cookie can be used and unset from any part of application.