Closed Thread Icon

Topic awaiting preservation: Saving $HTTP_REFERER in PHP (Page 1 of 1) Pages that link to <a href="http://ozoneasylum.com/backlink?for=12175" title="Pages that link to Topic awaiting preservation: Saving $HTTP_REFERER in PHP (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Saving $HTTP_REFERER in PHP <span class="small">(Page 1 of 1)</span>\

 
butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 04-14-2002 05:31

I'm working on a page that I want to be included from many different pages. It will have next, prev, and home links on it. I want the home link to take it back to the original referring page, so I need to capture it in a variable. I don't see why what I'm trying to do won't work.

At the top of the script I have this:

code:
if(!isset($orig_referer))
{
$orig_referer = $HTTP_REFERER; //save original referring page so we can get back home
}



In my html for the page I have this:

<FORM METHOD="POST">
<input type="hidden" name="orig_referer" value="<? echo $orig_referer; ?>">
</FORM>

Shouldn't the combination of the two save the value of $HTTP_REFERER to $orig_referer on the pages first load and then continue to pass it along with each page reload with the hidden form field?

Thanks

-Butcher-

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 04-14-2002 08:13

Are those prev, next, home links actually buttons on that form? If they are plain links (<a href=""></a> ), orig_referer variable won't be passed, because you must submit that form somehow.

If you're using plain links, you should add orig_referer parameter to each one, like this: <a href="index.php?action=next&orig_referer=blabla">NEXT</a> ...


butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 04-14-2002 18:44

Thanks mr.maX

Something along those lines hit me as I was going to work this morning. Could I also use onclick in the a tags to submit the form?

-Butcher-

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 04-14-2002 19:20

you could, if you would add the parameters by hand as max said.

if you really want to "submit" the forum than there is afaik no way around the <input type=submit> tag.

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 04-14-2002 20:18

You can submit form by using document.formName.submit() JavaScript call, but I think that it would be pointless. Either stick with plain links and add orig_referer variable as parameter or stick with form buttons...


butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 04-14-2002 20:49

Thanks for the extra explanation guys!

-Butcher-

« BackwardsOnwards »

Show Forum Drop Down Menu