Can somebody offer any suggestions.
In a form, with multiple select/option fields (option list generated by a php query), I wish to do the following.
There is a button associated with each select that calls
a new page with the selected option from the select.
I wish to pass the selected options when the form is submitted as a whole.
The buttons use Javascript to fill in the selected option in the query string to pass to the form.
To facilitate this, all the select tags have the same name which will cause Javascript to generate an automatic array. To get an automatic array for PHP the selects need to be named name[], which JavaScript does not like.
The only solution that I have come up with is to create a hidden field for each select which gets filled in with an onSubmit() function. This means that the JavaScript and the PHP functionality works.
This is the JavaScript for when the button alongside a select is clicked
function detClicked(thenum) {
if(document.cardform.cardsel[thenum - 1].selectedIndex==0)
alert('Slot ' + thenum + 'does not have a board selected');
else {
x=document.cardform.cardsel[thenum - 1].selectedIndex
urlparm='carddet.php?type=' + document.cardform.cardsel[thenum - 1].options[x].value + '&slot=' + thenum;
window.open(urlparm,'newwin','width=500,height=300');
}
}