Keep a hidden form element on your page which will be populated / updated whenever the user submits the form / changes the value of the secondary drop down. This hidden field can then be read using PHP at the server in the same way you read normal text fields.
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 733
Here is a sample script (untested):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv"Script-Content-Type" content="text/javascript">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Example</title>
<script type="text/javascript">
// This function sets the hidden field value to the value of the drop
// down contents in the form of comma separated values. Read this
// hidden variable at teh server just like any normal form field, parse
// it and pick out its contents.
function setHidden(frm) {
if(!frm) {
return;
}
var selBox = frm.elements["sel"];
var selValue = "";
for(var i = 0, maxI = selBox.options.length; i < maxI; ++i) {
var opt = selBox.options[i];
if(opt.selected) {
selValue += opt.value + ",";
}
}
var hiddenElem = frm.elements["hiddenParam"];
hiddenElem.value = selValue;
window.alert("The value to be submitted is: " + selValue);
frm.submit();
}
</script>
</head>
<body>
<form id="frm" name="frm" action="#">
<select name="sel" id="sel" multiple="multiple">
<option value="one">1</option>
<option value="two">2</option>
<option value="three">3</option>
<option value="four">4</option>
</select>
<input type="hidden" name="hiddenParam" id="hiddenParam">
<input type="submit" onclick="setHidden(this.form);">
</form>
</body>
</html>
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 733