[code]
<script language="JavaScript">
<!--
function one2two() {
m1len = m1.length ;
for ( i=0; i<m1len ; i++){
if (m1.options[i].selected == true ) {
m2len = m2.length;
m2.options[m2len]= new Option(m1.options[i].text);
}
}
for ( i = (m1len -1); i>=0; i--){
if (m1.options[i].selected == true ) {
m1.options[i] = null;
}
}
}
function two2one() {
m2len = m2.length ;
for ( i=0; i<m2len ; i++){
if (m2.options[i].selected == true ) {
m1len = m1.length;
m1.options[m1len]= new Option(m2.options[i].text);
}
}
for ( i=(m2len-1); i>=0; i--) {
if (m2.options[i].selected == true ) {
m2.options[i] = null;
}
}
}
function selectall() {
for (i=0; i<m2.length; i++) {
m2.options[i].selected = true;
}
}
//-->
</script>
<select name=ag_skill_menu[] size=16 multiple>
<option>Agronomy</option>
<option>Agricultural Development</option>
<option>Agricultural Economics</option>
<option>Agricultural Engineering</option>
<option>Animal Husbandry</option>
<option>Beekeeping</option>
<option>By-products</option>
</select>
<input type="button" onClick="one2two()" value="Add >> " >
<select name=ag_myskill[] size=16 multiple >
</select>
<input type="button" onClick="two2one()" value=" << Remove ">
<input type="submit" onClick = "selectall()" name="Submit" value="Save and Continue">
<script language="JavaScript">
var m1 = document.sp_skillForm.ag_skill_menu;
var m2 = document.sp_skillForm.ag_myskill;
</script>
</form>
[/code]
i have a select menu (using multiple) that i submit to a php file..and i want to process all the variables that are transmitted in that menu
basically i have 2 select menus....1 is a list of skills...the other is blank...then the user clicks the skills they have , which adds them to the blank select menu. when they hit the submit button, the php file processes what was submitted by using $_POST
the only problem is, it is submitted like this (i can tell by using GET)
skill=Woodworking&skill=Metalworking
so if i test it, $skill will just = metalworking
so to fix this, i thought i could rename the select something like <skill name = "skill[]">
however this seems to break the javascript. so is there a better way to do this? maybe i need to change my javascript? (i realize this is a php forum, heh..but any help would be apprecicated)