como puedo enviar los datos.
mi script es :
Código Javascript:
Ver original
<script type="text/javascript"> function Move_Select(objSourceElement, objTargetElement) { var aryTempSourceOptions = new Array(); var aryTempTargetOptions = new Array(); var x = 0; //looping through source element to find selected options for (var i = 0; i < objSourceElement.length; i++) { if (objSourceElement.options[i].selected) { //need to move this option to target element var intTargetLen = objTargetElement.length++; objTargetElement.options[intTargetLen].text = objSourceElement.options[i].text; objTargetElement.options[intTargetLen].value = objSourceElement.options[i].value; }else { //storing options that stay to recreate select element var objTempValues = new Object(); objTempValues.text = objSourceElement.options[i].text; objTempValues.value = objSourceElement.options[i].value; aryTempSourceOptions[x] = objTempValues; x++; } } //sorting and refilling target list for (var i = 0; i < objTargetElement.length; i++) { var objTempValues = new Object(); objTempValues.text = objTargetElement.options[i].text; objTempValues.value = objTargetElement.options[i].value; aryTempTargetOptions[i] = objTempValues; } aryTempTargetOptions.sort(sortByText); for (var i = 0; i < objTargetElement.length; i++) { objTargetElement.options[i].text = aryTempTargetOptions[i].text; objTargetElement.options[i].value = aryTempTargetOptions[i].value; objTargetElement.options[i].selected = false; } //resetting length of source objSourceElement.length = aryTempSourceOptions.length; //looping through temp array to recreate source select element for (var i = 0; i < aryTempSourceOptions.length; i++) { objSourceElement.options[i].text = aryTempSourceOptions[i].text; objSourceElement.options[i].value = aryTempSourceOptions[i].value; objSourceElement.options[i].selected = false; } } function sortByText(a, b) { if (a.text < b.text) {return -1} if (a.text > b.text) {return 1} return 0; } function selectAll(objTargetElement) { for (var i = 0; i < objTargetElement.length; i++) { objTargetElement.options[i].selected = true; } return false; } function seleccionar(obj) { a = new Array(); elem=document.getElementById(obj).options; for(i=0;i<elem.length;i++) { //elem[i].selected=true; //alert(elem[i].value); a[i] = elem[i].value } //elem[0].value = implode(a); //elem[0].selected= true; //a = new Array(0,1,2,3,4,5,6,7,8,9); return implode(a); } function implode(array){ var imploded=array[0]; for (i=1; i<array.length; i++)imploded += '+' + array[i]; return imploded } function llenardatos_select(LI,origen,destino) { var datos = LI.split("+"); for (i=0; i < datos.length; i++) { //alert (lineainv[i]); document.getElementById(origen).value = datos[i]; Move_Select(document.getElementById(origen),document.getElementById(destino)) } }function Move_Select(objSourceElement, objTargetElement) { var aryTempSourceOptions = new Array(); var aryTempTargetOptions = new Array(); var x = 0; //looping through source element to find selected options for (var i = 0; i < objSourceElement.length; i++) { if (objSourceElement.options[i].selected) { //need to move this option to target element var intTargetLen = objTargetElement.length++; objTargetElement.options[intTargetLen].text = objSourceElement.options[i].text; objTargetElement.options[intTargetLen].value = objSourceElement.options[i].value; }else { //storing options that stay to recreate select element var objTempValues = new Object(); objTempValues.text = objSourceElement.options[i].text; objTempValues.value = objSourceElement.options[i].value; aryTempSourceOptions[x] = objTempValues; x++; } } //sorting and refilling target list for (var i = 0; i < objTargetElement.length; i++) { var objTempValues = new Object(); objTempValues.text = objTargetElement.options[i].text; objTempValues.value = objTargetElement.options[i].value; aryTempTargetOptions[i] = objTempValues; } aryTempTargetOptions.sort(sortByText); for (var i = 0; i < objTargetElement.length; i++) { objTargetElement.options[i].text = aryTempTargetOptions[i].text; objTargetElement.options[i].value = aryTempTargetOptions[i].value; objTargetElement.options[i].selected = false; } //resetting length of source objSourceElement.length = aryTempSourceOptions.length; //looping through temp array to recreate source select element for (var i = 0; i < aryTempSourceOptions.length; i++) { objSourceElement.options[i].text = aryTempSourceOptions[i].text; objSourceElement.options[i].value = aryTempSourceOptions[i].value; objSourceElement.options[i].selected = false; } } function sortByText(a, b) { if (a.text < b.text) {return -1} if (a.text > b.text) {return 1} return 0; } function selectAll(objTargetElement) { for (var i = 0; i < objTargetElement.length; i++) { objTargetElement.options[i].selected = true; } return false; } function seleccionar(obj) { a = new Array(); elem=document.getElementById(obj).options; for(i=0;i<elem.length;i++) { //elem[i].selected=true; //alert(elem[i].value); a[i] = elem[i].value } //elem[0].value = implode(a); //elem[0].selected= true; //a = new Array(0,1,2,3,4,5,6,7,8,9); return implode(a); } function implode(array){ var imploded=array[0]; for (i=1; i<array.length; i++)imploded += '+' + array[i]; return imploded } function llenardatos_select(LI,origen,destino) { var datos = LI.split("+"); for (i=0; i < datos.length; i++) { //alert (lineainv[i]); document.getElementById(origen).value = datos[i]; Move_Select(document.getElementById(origen),document.getElementById(destino)) } } </script>
Mi Codigo es :
Código PHP:
Ver original
<form method="post" action="pp.php" style="margin:0;padding:0;"> <select name="disciplina" size="5" multiple="multiple" id="disciplina" style="width:352px;" onChange="javascript:Move_Select(this.form.disciplina, this.form.listadisciplina)" > <option value="1">disciplina 1</option> <option value="2">disciplina 2</option> <option value="3">disciplina 3</option> </select><br /> <select id="listadisciplina" name="listadisciplina" size="5" multiple="multiple" style="width:365px;" onChange="Move_Select(this.form.listadisciplina, this.form.disciplina)"> <option value="4">disciplina 4</option> <option value="5">disciplina 5</option> <option value="6">disciplina 6</option> </select> <br /> <input type="text" name="algo" value="2"> <br /> <input type="submit" name="enviar" value="Enviar"> </form> <?php echo "$_POST[listadisciplina] - $_POST[algo]"; ?>
el algo lo puse para probar que no este cometiendo yo un error pero nada :/
alguna idea?