Forum Moderators: coopster

Message Too Old, No Replies

saving link where php insert is located?

trying to save a link to where a php insert is located...

         

Tacklephile

10:42 pm on Mar 7, 2005 (gmt 0)

10+ Year Member



I have a review script on my website. The user clicks on a link that says, "post a review" located on a php page where the script is inserted. This takes them to a form to fill out, then a confirmation form, then it is saved to the database.

My question is, is there any way to save the link to the original php page where the review script is inserted? I tried _SERVER["PHP_SELF"] but it saved the link to the confirmation form. Is there any way to save the link to the referring page a couple of pages back?

Thanks for your input in advance!

badone

11:04 pm on Mar 7, 2005 (gmt 0)

10+ Year Member



$referring_page = $_SERVER['HTTP_REFERER'];

Will give you the referring page, if you want to go further back than that you will have to pass the referer you're intereted in to each page in turn.

Cheers,
BAD

Tacklephile

11:31 pm on Mar 7, 2005 (gmt 0)

10+ Year Member



Thanks for your help! How do I "pass the referer"?

badone

4:04 am on Mar 8, 2005 (gmt 0)

10+ Year Member



When you have the $referal_page variable set you can link to the next page like this;

next_page.php?referal_page=$referal_page

then in next page do something like;

$referal_page = $_GET['referal_page'];

Repeat as necessary.

Cheers,
Brad

Tacklephile

7:03 am on Mar 8, 2005 (gmt 0)

10+ Year Member



Thanks Brad! I got it working!

coopster

11:09 am on Mar 8, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>>I got it working!

That's always good news :) Welcome to WebmasterWorld, Tacklephile.

badone

8:46 am on Mar 9, 2005 (gmt 0)

10+ Year Member



Good job Tacklephile.