PDA

View Full Version : Filling an Input Value from a link


brett7481
02-22-2005, 06:47 AM
Okay I want members of my site to be able to invite other to join the site, but I want the members who are inviting to get credit when the invitee joins. I'm trying to set it up so that there is a referrer field in the registration form, and I want the referrer field to be already filled in. What I'm hoping to do is when a member invites someone the person being invited recieves an email, within the email is a link something like this: http://www.host.com/cgi-bin/eden2/ikonboard.cgi?act=Page;p=refer;refer=brett7481

The refer= should be what fills the input field. Now all the other data tacked onto the end there is already being used in my site's Ikonboard.

I'm sure this can be done, but with using Ikonboard it makes it a little more complicated. Is there an easy Perl solution, or maybe even a java script solution?

mlseim
02-22-2005, 04:36 PM
Is the registration for a static HTML page, or is it generated
by a script? In either case, I think that a Javascript would
work by watching the box where the user enters his/her
user name. Whatever text appears in that box would be
copied into the hidden variable "referrer".

Here's a Javascript example.
When the form gets sent, it will include the variable "referrer",
which will also be the same value as the TEXT BOX.

Use this as an example, and alter it for your own use.
========================================================

<HTML>
<HEAD>

<script language="JavaScript" type="text/javascript">
<!--
function copyData(from,to) { to.value = from.value; }
// return true ;
//-->
</script>

</HEAD>
<BODY>
<FORM name="myForm" ACTION="/cgi-bin/test.pl" METHOD="post">
<INPUT TYPE="hidden" NAME="referrer">
<br><br>
Your Email Address: <INPUT TYPE="text" NAME="email_address" onChange="copyData(this,document.myForm.referrer)" onKeyUp="copyData(this,document.myForm.referrer)">

<br><br>
<INPUT TYPE="submit" NAME="Submit" VALUE="Submit Form">
</FORM>
</BODY>
</HTML>