Back to previous page

Discussion in 'PHP' started by Iain, Oct 5, 2006.

  1. #1
    I have a JavaScript on my sites which takes readers back to the page from which they came, thus:
    <a href="#" onClick="history.go(-1)">back</a>

    Now, many of my readers surf with JavaScript dis-enabled!

    Please, does anyone know of a PHP script which goes pack to the previous page?
    Iain
     
    Iain, Oct 5, 2006 IP
  2. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
  3. Iain

    Iain Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Cyrogenius replied to someone on the 5th September and gave the following code which works well, thank you. Iain

    <?php
    $this = basename($_SERVER['PHP_SELF'], '.php');
    $prev = intval($this) - 1;
    $next = intval($this) + 1;
    $prevlink = $prev . '.php';
    $nextlink = $next . '.php'; echo "<a href=\"$prevlink\">&lt;&lt; Previous</a> | <a href=\"$nextlink\">Next &gt;&gt;</a>";
    ?>
     
    Iain, Oct 6, 2006 IP