SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2003
    Posts
    169
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Moving a variable to the second page

    I'm trying to create a "Send this page to a friend" form. Several pages will have this link. The form is at friend.php. In the friend.php page, I want the URL where the user came from.

    How do I make this (which works) into a more efficient PHP (or any other way) to send one variable into the friend.php page.
    Code:
     <form action="friend.php" method="get">
     <img src="images/emailtofriend.gif" alt="Email this page to a friend" width="15" height="11" />
     <input name="refurl" type="hidden" value="index2.php?page=award">
     <input type="submit" name="Submit" value="Send this page to a friend" class="livetext">
     </form>
    This button, by the way, has a css style so in the web browser, it looks like a regular live text hyperlink. That's what I want -- a simple text link, "Send this page to a friend", that goes to friend.php and in friend.php it displays the variable "refurl".

    Hope this makes sense.

  2. #2
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    PHP Code:
     echo $_SERVER['HTTP_REFERER']; 

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2003
    Posts
    169
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Cam
    PHP Code:
      echo $_SERVER['HTTP_REFERER']; 
    Thanks Cam for the quick reply. Works like a charm!

  4. #4
    SitePoint Guru
    Join Date
    Jul 2004
    Location
    Raleigh, NC
    Posts
    783
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    for practicality and for 90+% of what you'll ever need this for: use cam's solution. however, always remember that referers can be easily spoofed so never use them for anything when security is a concern


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
  •