SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    [Call me Bram] iBram007's Avatar
    Join Date
    Feb 2001
    Location
    Belgium
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Complicated referrer

    Is there a function like in php like this javascript function:
    history.back();

    If a user access one of my pages, I want a link back to his exact previous page. So if the user comes from:

    thread.php?threadid=3

    the link back has to be "thread.php?threadid=3"

    any ideas?

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Did you try $HTTP_REFERER;

    I did this simple test

    test1.php
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <
    html>
    <
    head>
        <
    title>Untitled</title>
    </
    head>

    <
    body>

    <
    a href="test2.php">go there</a>

    </
    body>
    </
    html
    test2.php
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <html>
    <head>
        <title>Untitled</title>
    </head>

    <body>

    <a href="<?=$HTTP_REFERER?>">go back</a>

    </body>
    </html>
    When I called up test1.php as http://localhost/test1.php?var=1

    I clikced on the link to go to test2.php and the back link contained http://localhost/test1.php?var=1
    which I think is what you want.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    [Call me Bram] iBram007's Avatar
    Join Date
    Feb 2001
    Location
    Belgium
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanx!

    I tought $HTTP_REFERER turns out in test1.php instead of test1.php?var=1...

    didn't test it

    thanx anyway!


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
  •