Ver Mensaje Individual
  #5 (permalink)  
Antiguo 21/05/2002, 09:03
reyj
 
Fecha de Ingreso: febrero-2002
Mensajes: 100
Antigüedad: 22 años, 2 meses
Puntos: 0
Re: cómo leo los valores de un select muliple en php?

El codigo es:

<html>
<head>

<SCRIPT LANGUAGE="JavaScript">
team = new Array(
new Array(
new Array("prueba", 45634),
new Array("Escultura", 6534),
new Array("prueba2", 4365346)
),
new Array(
new Array("construccion1", 43634),
new Array("construccion2", 34634)
),

new Array(
new Array("b", 346),
new Array("otro", 435634)
)
);

function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem) {
var i, j;
var prompt;
// empty existing items
for (i = selectCtrl.options.length; i >= 0; i--) {
selectCtrl.options[I] = null;
}
prompt = (itemArray != null) ? goodPrompt : badPrompt;
if (prompt == null) {
j = 0;
}
else {
selectCtrl.options[0] = new Option(prompt);
j = 1;
}
if (itemArray != null) {
// add new items
for (i = 0; i < itemArray.length; i++) {
selectCtrl.options[j] = new Option(itemArray[i][0]);
if (itemArray[i][1] != null) {
selectCtrl.options[j].value = itemArray[1];
}
j++;
}
// select first item (prompt) for sub list
selectCtrl.options[0].selected = true;
}
}
// End -->
</script>
</HEAD>

<body bgcolor="#FFFFFF" text="#000000">
<FORM NAME="main" method="get" action="eje_incluir_subcategoria.php3" enctype="multipart/form-data">
<SELECT NAME="Make" onChange="fillSelectFromArray(this.form.Team, ((this.selectedIndex == -1) ? null : team[this.selectedIndex-1]));">
<OPTION VALUE="-1">Select Team
<OPTION VALUE=1>Categoria1
<OPTION VALUE=2>Categoria2
<OPTION VALUE=3>Categoria3
<OPTION VALUE=4>Categoria4
</SELECT>
<BR>
<SELECT NAME="Team" SIZE="5" multiple>
<OPTION> </OPTION>
<OPTION> </OPTION>
<OPTION> </OPTION>
<OPTION> </OPTION>
<OPTION> </OPTION>
</SELECT>
<input type="submit" name="Submit" value="Submit">
</FORM>
</body>
</html>

Gracias