By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,287 Members | 1,545 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,287 IT Pros & Developers. It's quick & easy.

Updating cookies

P: n/a
I'm trying to implement a 30 day cookie to store a code related to our
affiliate program. I have this:

$pid = $_GET['PID'];
if (!is_null($pid)) {
setcookie('PID',$pid, time()+60*60*24*30, "/");
} else $pid = $_COOKIE['PID'];

The idea being, use any PID specified in the URL, overriding any
previous PID set in the cookie. Otherwise, use the cookie PID.
Unfortunately, the cookie never updates. I've tried adding this line
before I set the cookie, but it makes no difference:

setcookie('PID',FALSE);

--
Rossz
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Are you sending any other output to the browser before the call to
setcookie()? Or is the code above the very first thing in your script?
If it isn't, throw ob_start() at the very top and ob_end_flush() after
you call setcookie(). This might fix the problem.

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.