Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Have to manually refresh to get values from cookie

Status
Not open for further replies.

gelali

Programmer
Nov 6, 2004
7
0
0
US
Another question about the cookies!

One of my scripts will set cookie to change the prefrence of the user on how the site looks. The problem that it does not load the new settings untill the user hit refresh button manually on his browser.
Is there any way to make it load automatically after the cookie is set?

 
send the meta refresh tag after the cookie header

Bastien

Cat, the other other white meat
 
I tried refresh both through php or html, but still same problem.
 
Cookies can be accessed on the next page of the cookie set page.
so after setting a cookie, if you are using a cookie variable in a same script as Bastien said, refresh the page using javascript or html.

You can post your code here so that we can help you better.

--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
setcookie ('sitestyle', $allSettings, time()+31536000, '/', 'domain.com', '0');
header("Refresh: 0; URL=$HTTP_REFERER");

or

setcookie ('sitestyle', $allSettings, time()+31536000, '/', 'domain.com', '0');
$sUrl = "
echo "\n<meta http-equiv=\"refresh\" content=\"0;URL=$sUrl\">\n";

exit;
 
That was the code I tried. Can you see any problems?

Also, I have read that the time of the cookie sometimes could cause problems due to the difference between the server time and the user's machine time? Do you know anything about that?
 
Hi,

And does the page gets reloaded?

It is irrespective of the thing, whether you manually refresh the page or by code.


--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top