"Back to search results" link

Discussion in 'PHP' started by Omzy, Jan 18, 2009.

  1. #1
    I would like a "Back to search results" link to be displayed on a page only if the user accessed that page from the search results page (search.php). If the user accessed the page directly i.e by typing URL directly in to browser, the link does not get displayed.
     
    Omzy, Jan 18, 2009 IP
  2. inf

    inf Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You could use HTTP_REFERER

    
    if(strstr($_SERVER['HTTP_REFERER'], "search.php")) { echo ("Back to..."); }
    
    PHP:
     
    inf, Jan 18, 2009 IP