W3C home > Mailing lists > Public > www-talk@w3.org > January to February 2000

Re: problem

From: Igor Clark <igor@forefrontconsulting.co.uk>
Date: Thu, 27 Jan 2000 05:51:51 -0500 (EST)
To: Mukul Gandhi <mgandhi@bhartitelesoft.com>
cc: www-talk@w3.org
Message-ID: <Pine.WNT.4.21.0001271042240.-636153@igor>
Hiya

I think this might relate to how the php implementation of setCookie is
working and what order things get done in after a page compile.

You could:

(a) Try using header("Set-cookie: Name=etc");
(b) Try using a Refresh header instead:

	Refresh: 0; URL='http://www.php.net'

(c) Send an HTML document with a <script> that sets the cookie and does
the redirect client-side

Also, I'm not quite clear what you mean by

> header statement
> causes a new HTTP response to occur with fresh header and body which
> contain no cookies.

An HTTP response is only issued if the client makes an HTTP
request. Perhaps there is a client issue - what browser are you using?

Good luck,
Igor.

--
Igor Clark
igor@forefrontconsulting.co.uk

On Thu, 27 Jan 2000, Mukul Gandhi wrote:

> Hello ,
> A PHP script must simultaneously set the cookie and should redirect to a
> new page. Therefore HTTP headers from the server must go something like this -
> 
> Set-Cookie: NAME=a,VALUE=val1;
> Set-Cookie: NAME=b,VALUE=val2;
> Location: http://www.w3.org;
> 
> I am trying to do this using the code -
> setCookie("a","val1");
> setCookie("b","val2");
> header("Location: http://www.php.net");
> 
> With this control is going to the redirected page i.e http://www.php.net
> but the cookies are not getting set. But if I am ommiting the header
> statement, cookies are getting set. But I want to do both the things, i.e
> set cookie and redirect control to a new page.
> In what sequence the headers should be sent to achieve this ? With the
> combination of above 3 statements, I feel cookies never reach the client at
> all(and the original HTTP response gets aborted) and header statement
> causes a new HTTP response to occur with fresh header and body which
> contain no cookies.
> 
> Waiting for some response.
> 
> best regards
> -mukul
> 
> Ps: If server side programming is done in language other than PHP, the same
> concepts should apply.
> 
> --------------------------------------------------------------
> Bharti Cellular Limited, New Delhi, India
> 
> 
Received on Friday, 28 January 2000 17:56:35 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 27 October 2010 18:14:24 GMT