Passing page values to a hidden form field

J

Jaygo

I want to get the values from various page links to
a hidden field in a single online form. So if visitor A links
to the form from apples.htm and visitor B links to the
form from oranges.htm the value in the db table field would be
Apples or Oranges. Any pointers appreciated.

TIA John
 
K

kaeli

I want to get the values from various page links to
a hidden field in a single online form. So if visitor A links
to the form from apples.htm and visitor B links to the
form from oranges.htm the value in the db table field would be
Apples or Oranges. Any pointers appreciated.

TIA John

You could try document.referrer (or is it referer?), but I've heard it's
rather unreliable for internet applications.
A reliable method is to have the links on apples.htm and oranges.htm
send a value themselves. This requires recoding the links, however.
<a href="theURLwithTheForm.htm?ref=apples.htm">link</a>

Then you'd parse the URL, get the value of ref, and populate your form.

--
 
J

Jaygo

kaeli said:
You could try document.referrer (or is it referer?), but I've heard it's
rather unreliable for internet applications.
A reliable method is to have the links on apples.htm and oranges.htm
send a value themselves. This requires recoding the links, however.
<a href="theURLwithTheForm.htm?ref=apples.htm">link</a>

Then you'd parse the URL, get the value of ref, and populate your form.

--
--
~kaeli~
Doing my part to piss off the Religious Right.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
Many thanks Kaeili, nice cats we also have
two.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top