I am using this code:

setcookie("flash", "no", time() + (7 * 86400) , '/', 'thefaith.co.uk', 0);
$url = $_SERVER['HTTP_REFERER'];
header('Location: '.$url);

to set a cookie and then return the user to the page they were previosly using. However, I need to go back by two pages not one. I presume HTTP_REFERER is not the right thing to use for this, but can anyone tell me how I could, as the examples I have found all involve the user clicking a link.

    just an idear: why not add on every accessed php-page the referer to an array. so you could go back two steps in you history-array.

    not pretty, i know.

      The only thing about all of that is that the HTTP_REFERER is unreliable at best. See the following excerpt from the manual:

      'HTTP_REFERER'
      The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.

        I was only using the HTTP_RERFERER temporarily, and was hoping there was a simpler way than adding the referers on every page.

          one simple way

          <A HREF="javascript:history.back()">Back</ A>

            But doesnt that involve the user clicking on Back

              sorry your post title said back link

              how about using sessions to store the page progression

                Write a Reply...