PDA

View Full Version : Link change.


roystreet
8-9-02, 12:41 PM
Here's the question in detail:

I have two different sections that direct visitors to a form page.
But, I want to put a link on that form page that allows them to go back to the home page of the section that they came from.

I came from page A and went to form page, so I want the form page to have a link that says home page, but that it will send them back to page A.

Same with page B going to form page. It's homepage link will send them back to page B.

Got any ideas?

---roystreet

BerksWebGuy
8-9-02, 12:50 PM
3 ways of doing this (I think)

1. Make 2 forms pages for each referral page (easy)

2. Put a 'Back' button on the page (easy)

3. Use a script that reads where they came from...and can send them back (harder)


Good Luck:)

roystreet
8-9-02, 01:08 PM
Yes, I know, the two form design is much easier. But I wanted to learn something new, especially the back button or link. How do I do that?


Plus, I didn't want so many form pages...I've already have a few.


---roystreet

BerksWebGuy
8-9-02, 01:19 PM
Easy...


<a href="javascript:history.go(-1)" onMouseOver="self.status=document.referrer;return true">Go Back</a>


That's it. Will work for IE and Netscape.

Good Luck:)

roystreet
8-9-02, 01:23 PM
For some reason I thought I tried that before and it didn't work...
Maybe I wrote it a little differently. I think I might have tried to take it from a 404 error page or something like that. HeHe :D


Hey thanks....

---roystreet:)

Ap0s7le
8-9-02, 02:46 PM
or in PHP you can grab the referrer
<?php $referrer = getenv("HTTP_REFERER"); ?>

then in your code down where the link is... do
<a href="<?php echo $referrer ?>">Go Back</a>


later