… the cookie doesn’t work. $spw echoes nicely both before and after the cookie code, but the cookie is echoed as empty (i.e. “”). Either it is not being set or not being read right, or both. Anybody know??
Think about it … such an implementation is reasonable. The “Cookie” array contains the cookie values that are on the client, and when you “setCookie” in your PHP code, that cookie-value isn’t (yet…) on the client machine. (And it won’t be, until the HTML packet that you’re building is received by the client’s browser, and the cookie is accepted by that browser.) It does not surprise me at all that the content of this predefined array would not be altered by a “setcookie()” call. In fact, I’d probably design it that way.
Cookies are sent in the HTTP header. You can’t send them after you’ve already put data in the output buffer (your echo statements).
Cookies must be set before any output.
@sundialsvc4: That went completely over my head. Can you rephrase that?
@86point5: Welll helloooo… The part inserted above is at the very beginning of the file. I removed the echoes before the cookie part, and nothing happened. then I removed ALL the echoes, leaving the test of the cookie for later in the document (AFTER the HTML header had been set, with standard HTML code), and it worked!! Damn, PHP is a sensitive language, how do Javascript cookies fare in comparison? Am I more free to set such a cookie anywhere in the document??