Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Apr 2004
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cookie Redirection problem

    i am trying to make a "back" feature on a web site where the user can go back to a previous page. The problem is that when the user goes back to the page, the cached version of the page is coming up and not running the php again. is there a code i can put inside a page that will enable it to reload every time a user lands on a page?

    also, I am having a problem with a php script writing and retrieving cookies. is there something i

    am missing in code below?

    this is on the first page (setting the cookies)

    Code:
    <?php
    setcookie("onDemandExitTab", "news");
    setcookie("onDemandExitTabID", 2);
    ?>
    this is on the second page (reading the cookie)

    Code:
    <?php 
    
    if ($_COOKIE['onDemandExitTab'])
    {
    $startTab = $_COOKIE['onDemandExitTab'];
    $startTabID = $_COOKIE['onDemandExitTabID'];
    }
    else
    {
    $startTab = "networks";
    $startTabID = 0;
    }
    ?>
    Any help would be greatly apprecaited

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    Try this ... in the <head> section of your page.


    <head>
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="-1">
    </head>

  • #3
    New Coder
    Join Date
    Apr 2004
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for the reply

    that didnt work.

  • #4
    New Coder
    Join Date
    Nov 2007
    Location
    Thane-Vashi,Mumbai,India.
    Posts
    44
    Thanks
    3
    Thanked 2 Times in 2 Posts
    ^try putting it at the bottom of the page. So you could would look something like:

    Code:
    <html>
    <head>
    //1st set of headers
    </head>
    <body>
    </body>
    <head>
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="-1">
    </head>
    </html>
    This is some logic which I remember reading. It says that the no cache and pragma commands will work only if atleast 64K data has been sent to the browser. I don't remember exactly what it was.

    aah, got the link: http://www.htmlgoodies.com/beyond/re...le.php/3472881
    Last edited by Rohan_Shenoy; 03-06-2008 at 10:01 PM.

  • #5
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    I have another thing for you to try ...

    When you redirect back to the first page,
    use the WHOLE URL in the redirect.
    Example: http://www.mysite.com/pageone.php

    That might force a refresh ...
    Something I seem to remember from way back.


  •  

    Posting Permissions

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