Re: $_session/$_cookie trouble

From: Date: Tue, 28 Apr 2009 21:58:17 +0000
Subject: Re: $_session/$_cookie trouble
References: 1 2 3 4 5 6 7 8  Groups: php.general 
Request: Send a blank email to php-general+get-292112@lists.php.net to get a copy of this message
Gary wrote:
Thanks again, dont see any DOM.... As I mentioned I am no longer getting error message, but not sure it is working. I have this at the begining of the first file. <?php session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600);
    if (isset($_COOKIE['sale_cookie']) && isset($_COOKIE['assess_cookie'])) {
      $_SESSION['sale_value'] = $_COOKIE['sale_cookie'];
      $_SESSION['assess_value'] = $_COOKIE['assess_cookie'];
    }
?>
I have tried this echo $sale_value; echo $_SESSION['assess_value']; echo $_COOKIE['sale_cookie']; I have also removed all of the if() and still not had success None of which are producing results... Anyone see where I am going wrong... I have spent all day online, in the books, in the manual... Thanks again gary
Looks to me like you are trying to set and retrieve a cookie on the same page. It doesn't work that way. Set it, access it on the next page... or, set it, and then redirect to the same page.. being sure to send a flag to hide the setcookie function to avoid the dreaded infinite loop. Also, Setting a cookie's expire param to history will delete it... so I don't think that is what you want to do. Donovan -- =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o D. BROOKE EUCA Design Center WebDNA Software Corp. WEB:> http://www.euca.us | http://www.webdna.us =o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o=o WebDNA: [** Square Bracket Utopia **]

« previous php.general (#292112) next »