Get page url for original document when using an include

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dogstar
    New Member
    • Jan 2008
    • 2

    #1

    Get page url for original document when using an include

    I am trying to add a 'feedback' button on every page on a website. I want to add the button to the page footer which is accessed on each page using the include function. I want the feedback button to open a email form with a hidden option to include the url that the user has come from. I have tried

    $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

    and

    $url=$HTTP_SERV ER_VARS['SCRIPT_FILENAM E'];

    both of which give me the footer url rather than the actual page which the footer is included in.

    Any Ideas?




    In case the above doesn't make sense I have outlined the basics of the page coding below

    html
    head
    title etc
    /head
    body
    contents of page
    php include footer.php
    /body
    /html

    and the php code I have attempted is in the footer.php page
  • harshmaul
    Recognized Expert Contributor
    • Jul 2007
    • 490

    #2
    $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    Gives the current page.....


    $referer = $_SERVER['HTTP_REFERER'];
    Gives where the user clicked through from.....

    I'm not sure what you mean but i use the above code to track users through my sites.

    Comment

    • Dogstar
      New Member
      • Jan 2008
      • 2

      #3
      Thanks...FInall y got it working. Sorry for bad explanation of the problem.

      T

      Comment

      Working...