|
Multiple select to JS array
I am trying to submit several forms each containing a multiple select combo box and pass the results to another page. The problem I am having is when I select several options, only the first option is being sent to the next page. For example in the following code if I were to select options 1,2,3 and b,d only the values of 11111 and bbbbb are sent to the next page. Can anyone tell me where I'm missing the boat on this one?
Thanks
Harry
<html>
<Head>
<script>
function send_data()
{
document.form3.elements['fld1[]'].value = document.form1.elements['fld1[]'].value;
document.form3.elements['fld2[]'].value = document.form2.elements['fld2[]'].value;
document.form3.submit();
return false;
}
</script>
</head>
<body><center>
<form name="form1" onsubmit="return send_data">
<select name="fld1[]" size = "5" multiple>
<option value="11111">1</option>
<option value="22222">2</option>
<option value="33333">3</option>
<option value="44444">4</option>
<option value="55555">5</option>
</select>
</form>
<form name="form2" onsubmit = "return send_data()">
<select name="fld2[]" size = "5" multiple>
<option value="aaaaa">a</option>
<option value="bbbbb">b</option>
<option value="ccccc">c</option>
<option value="ddddd">d</option>
<option value="eeeee">e</option>
</select><br>
<input type="submit">
</form>
<form name="form3" action="ary2.php" method="get">
<input type="hidden" name="fld1[]">
<input type="hidden" name="fld2[]">
<form>
</body>
</html>
__________________
Beyond a critical point within a finite space, freedom diminishes as numbers increase. ...The human question is not how many can possibly survive within the system, but what kind of existence is possible for those who do survive."
Last edited by Harry; 07-11-2003 at 08:08 PM..
|