Re: Setting a cookie and redirecting
| From: | Richard Lynch | Date: | Wed, 03 Jul 2002 01:54:28 +0000 |
| Subject: | Re: Setting a cookie and redirecting | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-105101@lists.php.net to get a copy of this message | ||
>If you don't mind, I'm interested in learning more about what exactly
>ASP does differently. Are there two HTTP responses sent?
No, it just happens to have sent them in the order his browser liked.
ASP can't do anything "different" from PHP.
I used to laugh when ASPers asked why PHP had to do all this extra stuff
with cookies and stuff to do sessions. Sigh. :-)
Some browsers will process the headers in one order, others in the reverse.
Some will see the Location: and ignore the rest.
You can't do both and support all browsers.
>>kludged a fix by setting the cookie and then writing a page that uses a
>><META> refresh to redirect...
>>
>>Is there a more elegant way of doing this??
Re-design and re-factor your code so you don't need to re-direct. :-)
I rarely, almost never, use header("Location: ...");
Rule of Thumb:
If you have to do header("Location: ...") you have a
design/engineering/organizational problem in your code/pages/site.
I'm sure a zillion people will disagree with this "rule" I can only say
that when I started focussing on what my code was *really* doing, and really
factoring out the common things, and organizing my pages better, the
header("Location: ...") tool got thrown out (mostly) of my tool box.
YMMV.
--
Like Music? http://l-i-e.com/artists.htm