Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/04/2013, 09:45
Avatar de tquezada
tquezada
 
Fecha de Ingreso: febrero-2013
Ubicación: Santiago
Mensajes: 196
Antigüedad: 11 años, 2 meses
Puntos: 8
rescatar value de un combobox

hola a todos tengo este script
Código HTML:
Ver original
  1. <?
  2. session_start();
  3. set_time_limit(0);
  4. include("../inc/funciones.php");
  5. include("../inc/oConn.php");
  6. include("../inc/DesaWebPrueba.php");
  7. ?>
  8. <title>Problema</title>
  9. <script language="javascript">function crearText()
  10. {
  11.   var actuales = document.getElementById('seccion');
  12.   var cant=actuales.childNodes.length;
  13.   for(f=0;f<cant;f++)
  14.  {
  15.    actuales.removeChild(actuales.childNodes[0]);
  16.  }
  17.  var se = document.getElementById('seleccion');
  18.  var cantidad=0;
  19.  for(f=0;f<se.value;f++)
  20.  {
  21.    cantidad++;
  22.    var nuevohijo = document.createElement('input');
  23.    nuevohijo.type = 'text';
  24.    nuevohijo.name = 'deporte[]';
  25.    nuevohijo.id = 'nombre' + cantidad;
  26.    document.getElementById('seccion').appendChild(nuevohijo);
  27.    document.getElementById('seccion').appendChild(document.createElement('br'));
  28.  }
  29. }
  30. </script>
  31.  
  32. </head>
  33.  
  34.  <tr>
  35.     <td valign="top">Tipo de Deporte:<br /><br /><br />Integrantes:</td>
  36.    
  37.     <td valign="top">
  38.  
  39.     <select onChange="crearText()" id="seleccion">
  40.     <option value="0">Seleccione</option>
  41.    <?
  42.    $strSQL = "select           id_deporte,
  43.                       INITCAP(deporte),
  44.                       integrantes
  45.                       from RESERVA_DEPORTE order by id_deporte asc";   
  46.     $rsConn = $dbDesaP->Execute($strSQL) or die("Error");
  47.            
  48.        
  49.     while(!$rsConn->EOF){
  50.     ?>
  51.     <option value="<?php echo $rsConn->fields[2];?>"><?php echo $rsConn->fields[1];?></option>
  52.     <?
  53.    $rsConn->MoveNext();
  54.     }
  55.     ?>
  56.     </select>
  57.     <br>
  58. <div id="seccion">
  59. </div>
  60. <br>
  61.      
  62.     </td>
  63.   </tr>
  64. </form>
  65. </body>
  66. </html>

necesito rescatar el id del deporte seleccionado, pero en el value tengo los integrantes para generar los textbox, como puedo hacer para recoger la id en una variable para guardarla en una tabla?

Saludos.-
__________________
¿Sabes cuántos programadores hacen falta para cambiar una bombilla? - no, no ¿Cuántos? - Ninguno... es un problema de hardware.