CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2008
    Posts
    5

    initializing a cookie

    Greetings,

    I'm using a php cookie to maintain the website's menu state.

    currently I am setting the cookie in a php file, but the init is running everytime I have a page reload which is not good. I need this init to run just once during a session. I tried using a session variable instead, but the same problem exists.

    My question is: how can I init the cookie's value just once before the page loads?

    thanks in advance,

    sharper

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: initializing a cookie

    I'm assuming that this is all in reference to your question in Client-Side Scripting. If this is true, then I don't think you are implementing exactly what I had in mind with the cookies. I was refering to every time you make a menu change, you could use JavaScript to update the cookie which contains the menu information.

    Using a server-side solution to update the cookies will require you to reload the page every time...thus reverting you back to the original problem. And, you already mentioned in the other thread that you can't use AJAX, so communicating with PHP must require reloading of the page.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    May 2008
    Posts
    5

    Re: initializing a cookie

    After reading up on the required material I now understand what you were reffering to.

    i'm in the course of implementing a client side solution with session only cookies
    hope it works out.

    thank you for your help.



    UPDATE: worked like a treat , thanks for lowering the cliff a bit
    Last edited by sharper; May 16th, 2008 at 06:41 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured