...

View Full Version : read and write cookies without reloading



Helheste
08-07-2006, 09:50 PM
Hi, Im making a script, where a cookie is loaded and written on a place, but if the cookie is not on the users computer, I make it on the page using
setcookie ("cookie", "the text of the cookie", time()+3600);
and later in the page I want the cookie to be loaded in a specific place.
But ther problem is that the cookie is not loaded without the page is being refreshed, is there a solution for something like this?
Greetz

Mr J
08-08-2006, 09:31 PM
Try something on these lines

myCookie=getCookie("cookie")

if(!myCookie){
myString="the text of the cookie"
setCookie("cookie", myString, time()+3600)
}
else{
myString=getCookie("cookie")
}

You can then reference the variable myString later in the page



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum