Jump to content

Bizarre cookie problem


kjl-php

Recommended Posts

I have a redirect file, no code in it except a variable that builds a URL and appends a value from a cookie to it...bur for some reason it isn't grabbing the value from the cookie. I use the exact code on another site and it works...

 

Here's the code for the redirect page:

 

<?php

 

  $redirecturl = 'http://www.domain.com/?id='.$_COOKIE['my_cookie'];

  header('location: '.$redirecturl);

 

?>

 

I verified that there is in fact a value in the cookie by using the following code in a test page...(I tried both $_COOKIE & $HTTP_COOKIE_VARS because I don't really know the difference between the two but they both work in the test page anyways.)

 

<?php

echo $HTTP_COOKIE_VARS["subid_value"];

?>

 

Any reason why that I'm missing?

 

Thanks in advance,

Keith

Link to comment
https://forums.phpfreaks.com/topic/97882-bizarre-cookie-problem/
Share on other sites

If I type the URL in the browser of the redirect page, the resulting URL has the cookie value appended.

When I click a hyperlink to the redirect page, it doesn't show the cookie value and when I copy and past the URL in the browser it doesn't shows the cookie value.

 

I cleared the cache, etc.

 

Any ideas?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.