Re: question regarding cookies

From: Date: Wed, 26 Dec 2001 22:32:14 +0000
Subject: Re: question regarding cookies
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-78797@lists.php.net to get a copy of this message
Good advice -- I hadn't thought of that (echoing right beneath the setcookie() function). But then i thought of something else... how can I echo text before the "<html>" tag? So I put a third setcookie() function above the <html> tag setcookie("foo", "echobar") hoping that this would be very simple -- set a cookie with the value of "echobar", then later (in the <body> of the page) add echo "<p>$foo</p>" ; Well, it didn't work either, unfortunately. "echobar" didn't appear on my page. And I'm not getting any errors, either.... So the answer to no. 1 is now yes, but the cookie didn't get sent. No. 2, I tried a sort of test (but the one you suggest gave me an error message b/c it's trying to echo text in the headers or something). No. 3, no errors. I'm still reading the www.php.net page on setcookie()... hoping for something that says that perhaps my browser is the source of the problem. Erik On Wednesday, December 26, 2001, at 04:40 PM, Miles Thompson wrote:
1. Did you just try setting a cookie, plain, with no conditions. 2. Have you tested your conditions, or added a test, equivalent to what you do when you set the cookie? In other words, change setcookie to this .... if ($type_sel) { setcookie("font[type]", $type_sel, time()+3600) ; echo "type_sel: $type_sel; } 3. Are you getting any errors when you try to set the cookie?


« previous php.general (#78797) next »