Reply to Re: setting cookie before leaving page

Your name:

Reply:


Posted by thib΄ on 11/11/65 12:00

MangroveRoot wrote:
> However, what I'm finding is that the cookie does not get set
> unless and until the visitor clicks REFRESH in the browser
> (or does anything equivalent);

This is absolutely normal. From the man':
"Cookies will not become visible until the next loading of a page that the
cookie should be visible for."

> if they don't think to do that, the cookie remains obsolete.

Well do it for them; after setcookie(), just do a header('Location: ' .
$_SERVER['PHP_SELF']) and, of course, a die().

Basically, this isn't necessary since you've got the date you need in the
$_GET. However, the refreshing method might be a better solution to avoid
the user to be prompted by his browser to resend the post data if he reloads
the page manually, for whatever reason.

Read about the PRG design pattern.
http://en.wikipedia.org/wiki/Post/Redirect/Get
http://www.theserverside.com/patterns/thread.tss?thread_id=20936

-thibΒ΄

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация