how to create back/next link

Discussion in 'PHP' started by adsegzy, Jul 12, 2010.

  1. #1
    Hello there,

    I want to create back link and next link on my pages so that visitors can go back to the previously visited pages, how do i get the URL of these previous pages, or how do i go about it.

    regards
     
    adsegzy, Jul 12, 2010 IP
  2. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #2
    Are you talking about wordpress ?
     
    Bohra, Jul 12, 2010 IP
  3. Rainulf

    Rainulf Active Member

    Messages:
    373
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    85
    #3
    Please elaborate. It depends on how your pages are setup. If your URLs are setup like this:
    http://yourwebsite.com/?page=1 ...  ?page=2... ?page=3.. etc
    Code (markup):
    Then the easiest way are simple increment/decrement and ifs statements - the "Next" link will contain $current+1 and the "Prev" link will contain the opposite, $current-1 :)
     
    Rainulf, Jul 12, 2010 IP
  4. coderXO

    coderXO Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The next and back pages are from the results of a database query?
     
    coderXO, Jul 13, 2010 IP
  5. adsegzy

    adsegzy Peon

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    thank you everyone, i have gotten a simple solution to it. this is the solution

    <a href="javascript: history.go(-1)">Back to Previous Page</a>
    <a href="javascript: history.go(+1)">Back to Next Page</a>
     
    adsegzy, Jul 14, 2010 IP
  6. jjeezy

    jjeezy Peon

    Messages:
    103
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Use Wordpress and you wouldn't have to worry about it at all!
     
    jjeezy, Jul 14, 2010 IP