Click to See Complete Forum and Search --> : cookies Netscape/IE


tripwater
09-30-2003, 01:18 PM
Hello I have a section of my site that you select a project then it takes you to the next page and you select the sections based on the project you selected.

Now I am setting a cookie on the user's computer to remember the project & section they last selected so they do not have to reselect them.

It is working fine in Mozilla/Netscape/Galleon browsers but not IE.

I can even echo the cookie in all of the browsers but IE. I found the cookie file in my Documents folder and it is writing the correct id in for the project, just not retreiving it. Here is how I am setting the cookie :


//here we set a cookie for selecting a project
if (!empty($HTTP_POST_VARS["project"]))
setcookie ("Project", $HTTP_POST_VARS["project"],time()+60*60*24*30);






Then I build a dynamic droplist based on query results and have the set cookie as selected. Again this works everywhere else but IE.

I use
if (isset($HTTP_COOKIE_VARS["Project"]))


Any ideas? Thanks ahead of time.

PunkSktBrdr01
09-30-2003, 02:30 PM
Do you have cookies disabled in IE?

tripwater
09-30-2003, 02:50 PM
Thanks for the reply.

It was set to All cookies accepted.

I noticed that it still does not select my project, but once I reselect the project and go to the next page, It has the correct section selected.

So I thought this would mean I have something wrong in my code for the Project but I looked and it looks correct, besides it works in all of the other browsers. I am a bit confused.

PunkSktBrdr01
09-30-2003, 04:23 PM
Are you using an older version of IE? Your version might have problems with cookies. Do cookies work on other sites?

tripwater
09-30-2003, 04:36 PM
I figured it out. I needed to add a couple of parameters to the set_cookie function to make it available within the entire domain and subdomains

the "/", ".mydomain.com" after the time().



thanks for the help.

pyro
09-30-2003, 10:52 PM
Odd that it would work in any browser, if you were trying to get them to work in multiple directories an didn't have them set... :confused:

tripwater
10-01-2003, 07:34 AM
No all of the pages I was working with were in the same directory. For some reason THough, not have these extra params defined caused IE to not work properly on some of the pages. Which still does not make much sense.

pyro
10-01-2003, 07:46 AM
If the pages were in the same directory, it should have worked fine on all browsers. If the pages were in different directories, it shouln't have worked in any browers...

tripwater
10-01-2003, 07:58 AM
That's pretty much what I thought. But we had an odd problem...

even though the pages were in the same directory, I set one of the cookies (a test) on the page before we set our first cookie originally,(all in the same directory) and the cookie was set but in Windows a separate text file was created for this new cookie again, even though it was in the same directory.

What was REALLY messed up was Windows created the second text file with the exact same name in the same directory which should be impossible both files were named say "test/"

I admit I do not have alot of indepth knowledge of cookies but the other cookie file on the windows machine held the cookies for all of the other pages...including the one that was not showing up in my droplist...it was there.

Once we added the params for the domain and where to store the cookie "/" then all worked fine.