Passing variable from page1,page2, page3 via URL

admin

Administrator
Staff member
How do I pass the value of variables into my next webpage's URL? In the sample code below I'd like to pass the value of the variables "argname" and "value" retrieved from the QueryString into the URL of my next webpage. I'm using a hidden form and I'd like to substitute the value of the variable 'argname' for the value field in the hidden form. Or maybe someone knows of a better way. Thanks!

(<input type="hidden" name="fruits" value=http://www.webdeveloper.com/forum/archive/index.php/"argname">)


Here's some sample code:
===================
<script language="JavaScript" type="text/JavaScript"><!--

var argname = "";
var value = <!-- m --><a class="postlink" href="http://www.webdeveloper.com/forum/archive/index.php/">http://www.webdeveloper.com/forum/archive/index.php/</a><!-- m -->"";
var pairs = "";

QueryString.keys = new Array();
QueryString.values = new Array();
QueryString_Parse();

function QueryString(key){
var value = null;
for (var i=0;i<QueryString.keys.length;i++){
if (QueryString.keys==key){
value = QueryString.values;
break;
}
}
return value;
}


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

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


//-->
</script>
</head>
<
.....
.....
.....
<p>My WebPage:</p>
<form action="http://mylocalhostname/samplehost/getfruits.shtm" method="get" name="form3" id="form3">
<p>
<select name="fruit" size="1" id="fruit">
<option value=http://www.webdeveloper.com/forum/archive/index.php/"hr" selected>Head Revision</option>
<option value="orange">orange</option>
<option value="apple">apple</option>
</select>
</p>
<p>
<input type="hidden" name="fruits" value="argname">
<input type="submit" name="Submit" value="Next"></form>
</p>
</form>
 
Back
Top