Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need page referrer info transfering to result form page?

Status
Not open for further replies.

Happy100

Technical User
Jun 25, 2004
102
GB
Hi

I am using this little piece of code (see below) to pass on the location and referrer page details to me in a email. But I would like these details to also show in the html confirmation page.

Can anyone advise me what code I would need to place in this confirmation page?


<script language="JavaScript">
<!--
loc = document.location.href;
ref = document.referrer;
document.write("<input type=hidden name=location value='" + loc + "'>");
document.write("<input type=hidden name=referrer value='" + ref + "'>");
// -->
</script>

Many thanks

Happy
 
What do you want the fields to look like? Are the referrer and location supposed to be in hidden fields? Something like:
Code:
function writeHiddens()
{
  var loc = document.location.href;
  var ref = document.referrer;
  document.write("<input type=hidden name=location value='" + loc + "'>");
  document.write("<input type=hidden name=referrer value='" + ref + "'>"); 
}
// ...
<form method="post" action="page.php">
 <script type="text/javascript">writeHiddens();</script>
</form>

--Chessbot

There is a level of Hell reserved for probability theorists in which every monkey that types on a typewriter produces a Shakespearean sonnet.
 
Hi chessbot

I would like the field results to be visible, so the visitor can print the confirmation page and have the original link on paper.

I know very little about Javascript, so would it be possible you can advise how and where I use the code you have given me?

Many thanks

Happy.
 
Code:
<html>
<head>
<script type="javascript">
function writeInfo()
{
  document.writeln("You came from " + document.referrer);
  document.writeln("You are at " + location.href);
}
</script>
</head>
<body>
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah 
<script type="text/javascript"> writeInfo(); </script>
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah vblah blah blah blah blah 
</body>
</html>

--Chessbot

There is a level of Hell reserved for probability theorists in which every monkey that types on a typewriter produces a Shakespearean sonnet.
 
Hi again Chessbot

I inserted the code where you said, but I get nothing showing on the form confirmation web site?

Please see - and follow the link, at will go to the form and them hit submit and that will give the confirmation page where I would like the referrer/location to show.

Many thanks

Happy.
 
Code:
<script type="[red][b]text/[/b][/red]javascript">
...

--Chessbot

There is a level of Hell reserved for probability theorists in which every monkey that types on a typewriter produces a Shakespearean sonnet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top