View Full Version : Ok, I have two forms in seperate html files, but i want one value from.....

Silver Sun
12-19-2002, 01:27 AM
....form 1 to be carried into form 2.

say i have:
<form action="page2.html" method="get/post">
<input type="text" value="patrick" name="name">

in form one. Now what i want is the value "name" to be carried from this form into a hidden input field in a form on page 2.

How do i do this?

thanks in advance

12-19-2002, 01:43 AM
Im not sure if that could be done using javascript.. I would suggest using a server side language such as perl or asp.

12-19-2002, 02:21 AM
Give this a try

function QueryString(key)
var value = null;
for (var i=0;i<QueryString.keys.length;i++)
if (QueryString.keys[i]==key)
value = QueryString.values[i];
return value;
QueryString.keys = new Array();
QueryString.values = new Array();

function QueryString_Parse()
var query = window.location.search.substring(1);
var pairs = query.split("&");

for (var i=0;i<pairs.length;i++)
var pos = pairs[i].indexOf('=');
if (pos >= 0)
var argname = pairs[i].substring(0,pos);
var value = pairs[i].substring(pos+1);
QueryString.keys[QueryString.keys.length] = argname;
QueryString.values[QueryString.values.length] = value;



You'd have to use method="get" on your form

12-21-2002, 02:01 AM
can't you just set the cookies to set it i made something like that in perl tho

12-21-2002, 05:52 AM
cookies way:

<script type="text/javascript" language="javascript">
function strCook() {
document.cookie = escape(document.forms[0].test.value);
<input type="text" value="" name="test">
<input type="button" value="store cookie" onClick="strCook()">

and on the other page

<script type="text/javascript">
setTimeOut("document.forms[0].test0.value = unescape(document.cookie);
<input type="text" value="" name="test0">