SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2007
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question cookie+display banner in order, not random.

    How can I use cookie to set the display order of banner in my site?

    I've a site which currently using random method to rotate banner. However, I wish to make it appear in order. I've tried on some method but they are not working. May I know what's the exact way to make it work?

    My previous throey is when the site 1st launched, it will create a cookie eg $_COOKIE['banner']=1;

    When the page is reloaded, $_COOKIE['banner']=2;$_COOKIE['banner']=3; and so on...

    However, I just could not get the banner value to increase. Can I change the cookie value every time the page loads? How?

    Thanks in advance!!!

  2. #2
    SitePoint Member etheon's Avatar
    Join Date
    Aug 2007
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use the function setcookie() to do something like that. As far as I know, $_COOKIE is just for fetching/displaying a cookie's value.

    Example :
    setcookie("banner", ($_COOKIE['banner'] + 1));

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2007
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by etheon View Post
    You can use the function setcookie() to do something like that. As far as I know, $_COOKIE is just for fetching/displaying a cookie's value.

    Example :
    thanks for your reply...

    I'll try it out now...



Bookmarks

Posting Permissions

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