SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast jyoung123's Avatar
    Join Date
    Jan 2001
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HTTP_REFERER and passed variable pages

    I'm using a simple "Recommend this page" script that prints the recommended page with the following code:

    Code:
    $referer = getenv("HTTP_REFERER");  
    print "<B>$referer</B><BR><BR>";
    This works fine for regular PHP pages such as
    http://www.example.com/info.php

    But if it is a page which has some variable passed to it such as
    http://www.example.com/info.php?id=4

    it will only reference "http://www.example.com/info.php" as the page to be recommended.

    Thus, how do I enable $referer to also include the passed variables?

  2. #2
    Non-Member QualityWebHosts's Avatar
    Join Date
    Sep 2003
    Location
    USA
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    referer depends on what is sent by the browser
    if you dont see it now, you probably wont be able to see it at all.

  3. #3
    SitePoint Wizard
    Join Date
    Oct 2001
    Posts
    2,686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What if you use the "QUERY_STRING" aswell?
    PHP Code:
    $referer getenv("HTTP_REFERER");  
    $querystring getenv("QUERY_STRING");  
    print 
    "<B>$referer?$querystring</B><BR><BR>"
    HTH

    -Helge

  4. #4
    SitePoint Enthusiast jyoung123's Avatar
    Join Date
    Jan 2001
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That did the trick. Thanks!!


Bookmarks

Posting Permissions

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