SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    858
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Referrer won't remain constant in a variable

    I have a page called, displayContact.php. This page pulls up the details for a given user in the database. I have designed this page to accept a uID from several other pages, so there are many pages that can send me to displayContact.php. I'm trying to fix it so that when I click the "Update Database" button, it displays a text link that will allow me to return to the other page that brought me to displayContact.php in the first place. displayContact.php simply reloads itself when the "Update Database" button is clicked.

    My problem is that the $sendBack URL is never the URL of the webpage that brought me to displayContact.php Does this make sense? Here is my code. I've attemped to write it so the referrer would not be over-written when displayContact.php reloads to update the database with changes made. This code appears in the section on my page where it checks for the action... if $action=viewRecord. If my understanding is correct, this code should only be executed once, that is, when the page is first loaded. But somehow $sendBack is being changed when the page reloads.

    Please help.

    Code:
    $referrer = $_SERVER['HTTP_REFERER'];
    if ($captured_referrer =="") {
    $sendBack = $referrer;
    $captured_referrer = "Yes";
    }

  2. #2
    $this->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Dec 2003
    Location
    Federal Way, Washington (USA)
    Posts
    1,524
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's easier to do this in javascript.
    Code:
    <a href="javascript:history.go(-1)"> Go Back </a>
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    Showcase your music collection on the Web

  3. #3
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    858
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Wow, this works good. Thanks for the tip. One problem though. It simply returns me to the page that sent me here. What I really need it to do is re-run the script of the page that was the referrer. The query on the page will only show people who's record has not been modified today. By re-running the actual page, it should remove the person who I just updated. I hope this makes sense.

    Thank you!

  4. #4
    $this->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Dec 2003
    Location
    Federal Way, Washington (USA)
    Posts
    1,524
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmm. Why not send the referring URL to this page as a Post variable? Then use that to go back where you came from? Or am I totally misunderstanding what you want to do?
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    Showcase your music collection on the Web


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
  •