Results 1 to 3 of 3

Thread: PHP link needs to be clicked twice to set cookie

  1. #1
    Join Date
    May 2009

    PHP link needs to be clicked twice to set cookie

    I've used a cookie to select which style sheet displays on a page, but have found that I have to click on a link twice before the changes are reflected.

    I have the following in the header
    PHP Code:
    setcookie ('select-stylesheet'$chosentime()+31536000'/''mydomain.com''0'); 
    and the following in the body where I want a visitor to be able to select the style sheet they view

    HTML Code:
    <a href="?chosen=default">default sheet</a>
    Any ideas as to why this might happen?

  2. #2
    Join Date
    Aug 2004
    New York
    It sounds like your reading the cookie or looking for what to display before you set the cookie which would give this result. Double check the order of things.

  3. #3
    Join Date
    May 2009
    Thanks Reli4nt,

    I put the cookie in another page and then redirected back to the page I wanted to refer to it from. That seems to have worked.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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