Ver Mensaje Individual
  #3 (permalink)  
Antiguo 28/04/2013, 15:01
marisanjr
 
Fecha de Ingreso: abril-2013
Mensajes: 53
Antigüedad: 11 años
Puntos: 0
Respuesta: select multiple

Pido mil disculpas por lo de urgente. Gracias por responderme.

Cree un array llamado sel2 con una funcion agregar. Lo que quiero es recorrer el array sel2 y buscar ese valor en una tabla Mysql. Cómo lo hago con PHP?

<html>
<head>
<title></title>

<script type="text/javascript">
var j=0;
function agregar(){

var aa = document.form1.lista.options.selectedIndex, rec = new Array();

if(aa !=-1){
for(i=0;i<document.form1.lista.options.length;i++) {
rec[i] = document.form1.lista.options[i].text;
if(document.form1.lista.options[i].selected){
document.form1.sel2.options[j] = new Option(rec[i],rec[i]);
j++;
}
}

}

else
alert("no hay opciones selecciondas");
}


function restar(){

var sel="", aa = document.form1.sel2.options.selectedIndex, rec = new Array();

if(aa !=-1){
for(i=0;i<document.form1.sel2.options.length;i++){
rec[i] = document.form1.sel2.options[i].value;
if(document.form1.sel2.options[i].selected){
document.form1.sel2.options[i] = new Option("","");
}
}
}

else
alert("no hay opciones selecciondas");

}

</script>

</head>

<body>


<form name="form1">

<select multiple size="5" name="lista">
<option value="1">CALI</option>
<option value="2">PAMIRA </option>
<option value="3">CANDELARIA</option>
<option value="4">CARTAGO</option>
<option value="5">TULUA</option>
<option value="6">BUGA</option>
<option value="7">VERSALLES</option>
</select>


<select style="width:180px;height: 90px" size="5" name="sel2">
</select>

<input type="button" value="agregar -->" onclick="agregar()" />
<input type="button" value="<-- restar" onclick="restar()" /></br>

<br><input type="submit" name="submit" value="Aceptar"/></center></br>

</form>
<?php
if (isset($_POST['submit'])) {
$array=sel2(); ///??????No se como convertirlo a un query php

}
?>

</body>
</html>

Última edición por marisanjr; 28/04/2013 a las 15:23 Razón: falto agregar informacion