Re: [PHP] setcooke(...) before header(Location: XYZ) - Cookie doesn't set!
Sorry, that message it what is in the body of the response, so it's not working, I think. Unless that's what it's supposed to do. In that case, it won't work for what I want. I simply want the form to send to the php file, which then processes the information, and redirects the user to the next screen. I would like the transition to be invisible. On a related question, I guess I could use global variables instead of cookies. Is there a benefit or detriment to that, other than it doesn't persist like a cookie would? Thanks, Mike Michael Sims [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Tue, 21 Jan 2003 20:17:40 -0700, you wrote: I tried a test file with this, and the form is sent, and the nph-test2.php file returns this Status: 302 Content-type: text/html X-Powered-By: PHP/4.3.0 Location: test.php Set-Cookie: testcookie=test I'm a bit confused. Is it working for you now, or not? What do you mean by returnsis the above sent as an HTTP response header? Or does this show up in the body of the response? Since the above contains the 'Set-Cookie' directive (which IIS would normally strip out) it should be working... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setcooke(...) before header(Location: XYZ) - Cookie doesn't set!
--- Mike Potter [EMAIL PROTECTED] wrote: I am using Microsoft IIS with the latest PHP installed. Here's a smple: setcookie(testCookie, testValue, time() + 3600, /); header(Location: http://newpage.php;); exit; This will not work with IIS. You need to use a meta refresh or something to work around it. You can find out more here: http://marc.theaimsgroup.com/?l=php-generalm=102929828515647w=2 Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] setcooke(...) before header(Location: XYZ) - Cookie doesn't set!
Mike IIRC this is a known bug with IIS (not PHP) when it gets the http redirect it junks the cookie - sorry I can't remember much more detail than that... Workaround maybe is to spit out an HTML based META refresh redirect tag instead of using the header() call. HTH Rich -Original Message- From: Mike Potter [mailto:[EMAIL PROTECTED]] Sent: 21 January 2003 15:35 To: [EMAIL PROTECTED] Subject: [PHP] setcooke(...) before header(Location: XYZ) - Cookie doesn't set! HELP! I know I'm new at this so please don't laugh. But I can't get this to work! I am using Microsoft IIS with the latest PHP installed. Here's a smple: . . . setcookie(testCookie, testValue, time() + 3600, /); header(Location: http://newpage.php;); exit; Later, I pull the cookie: echo $_COOKIE[testCookie]; and there is no value. If I don't use the header function at the end, and write something to the page, it works fine. Why does this cookie not get set? Thanks a ton! Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setcooke(...) before header(Location: XYZ) - Cookie doesn't set!
Do you know how do do this? Thanks, Mike Jason K Larson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Discussion on this list has suggested that it can work if PHP is set to run as ISAPI, not CGI. HTH, Jason k Larson Mike Potter wrote: HELP! I know I'm new at this so please don't laugh. But I can't get this to work! I am using Microsoft IIS with the latest PHP installed. Here's a smple: . . . setcookie(testCookie, testValue, time() + 3600, /); header(Location: http://newpage.php;); exit; Later, I pull the cookie: echo $_COOKIE[testCookie]; and there is no value. If I don't use the header function at the end, and write something to the page, it works fine. Why does this cookie not get set? Thanks a ton! Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setcooke(...) before header(Location: XYZ) - Cookie doesn't set!
[top-posting fixed] Jason K Larson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Discussion on this list has suggested that it can work if PHP is set to run as ISAPI, not CGI. Do you know how do do this? Although using the ISAPI dll version of PHP would definitely work, that's a bit of a drastic solution. Chris has pointed you in the direction of a workaround. Why don't you give it a shot and if you can't get it working send another message to myself or the list: http://marc.theaimsgroup.com/?l=php-generalm=102929828515647w=2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setcooke(...) before header(Location: XYZ) - Cookie doesn't set!
I tried a test file with this, and the form is sent, and the nph-test2.php file returns this Status: 302 Content-type: text/html X-Powered-By: PHP/4.3.0 Location: test.php Set-Cookie: testcookie=test Here is my code: ?php header(HTTP/1.0 302 Redirect); header(Location: test.php); header(Set-Cookie: testcookie=test); ? Thanks for your time. Mike Michael Sims [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... [top-posting fixed] Jason K Larson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Discussion on this list has suggested that it can work if PHP is set to run as ISAPI, not CGI. Do you know how do do this? Although using the ISAPI dll version of PHP would definitely work, that's a bit of a drastic solution. Chris has pointed you in the direction of a workaround. Why don't you give it a shot and if you can't get it working send another message to myself or the list: http://marc.theaimsgroup.com/?l=php-generalm=102929828515647w=2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setcooke(...) before header(Location: XYZ) - Cookie doesn't set!
I tried this one as well. When trying to load, the browser says HTTP 500 - Internal server error Internet Explorer I even rebooted! Mike Jason K Larson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Follow the ISAPI module install instructions. http://www.php.net/manual/en/install.iis.php Regards, Jason k Larson Mike Potter wrote: Do you know how do do this? Thanks, Mike Jason K Larson wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Discussion on this list has suggested that it can work if PHP is set to run as ISAPI, not CGI. HTH, Jason k Larson Mike Potter wrote: HELP! I know I'm new at this so please don't laugh. But I can't get this to work! I am using Microsoft IIS with the latest PHP installed. Here's a smple: . . . setcookie(testCookie, testValue, time() + 3600, /); header(Location: http://newpage.php;); exit; Later, I pull the cookie: echo $_COOKIE[testCookie]; and there is no value. If I don't use the header function at the end, and write something to the page, it works fine. Why does this cookie not get set? Thanks a ton! Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setcooke(...) before header(Location: XYZ) - Cookie doesn't set!
On Tue, 21 Jan 2003 20:17:40 -0700, you wrote: I tried a test file with this, and the form is sent, and the nph-test2.php file returns this Status: 302 Content-type: text/html X-Powered-By: PHP/4.3.0 Location: test.php Set-Cookie: testcookie=test I'm a bit confused. Is it working for you now, or not? What do you mean by returnsis the above sent as an HTTP response header? Or does this show up in the body of the response? Since the above contains the 'Set-Cookie' directive (which IIS would normally strip out) it should be working... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php