i have the following code:
setcookie("pud_visit", "visited", time()+604800, "/");
but when i try to use it i get the following error:
Warning: Cannot add header information - headers already sent
any ideas why?
thank you
yeah gilly , the cookie needs to be sent in the header that is before sending anything else. You are sending data using echo or print or outputting plain html , then calling the setcookie function. It will definitely not work. The first output to the browser needs to be the setcookie function.