Foro de elhacker.net

Programación => Programación Visual Basic => Mensaje iniciado por: rvilla777 en 6 Septiembre 2013, 16:58 pm



Título: Capturar datos de checkbox
Publicado por: rvilla777 en 6 Septiembre 2013, 16:58 pm
Buenos dias, tengo un problema con la captura de datos de varios checkbox seleccionados.

Lo que quiero hacer es enviar todos los datos de checkbox seleccionados y capturarlos en un array en otra página, para luego realizar consultas sql .

Este es mi codigo en html.


Código
  1. <script language="javascript">
  2. function noborrar()
  3. {
  4. alert("Para modificar los datos favor de ingresar a sistema SUF.");
  5. }
  6.  
  7. <form method="POST" action="traspaso_suf.asp">
  8. <div align="center">
  9. <table border="0" width="85%" id="table3" cellspacing="0" cellpadding="0">
  10. <tr>
  11. <td align="center">
  12. <table border="1" width="100%" id="table4" style="border-left-width: 0px; border-right-width: 0px" bgcolor="#FFFFCC">
  13. <tr>
  14. <td colspan="5" bgcolor="#000080" style="border-style: solid; border-width: 1px">
  15. <b><font face="Arial" size="2" color="#FFFFFF">Proyectos en
  16. SUF (<%Response.Write r_usuario%>) </font></b></td>
  17. </tr>
  18. <tr>
  19. <td style="border-style: none; border-width: medium" width="8%">
  20. Selección</td>
  21. <td style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-bottom-style: none; border-bottom-width: medium" width="35%">
  22. Fecha</td>
  23. <td style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-bottom-style: none; border-bottom-width: medium" width="52%">
  24. Nombre del Proyecto</td>
  25. <td style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-bottom-style: none; border-bottom-width: medium" width="2%">
  26. &nbsp;</td>
  27. <td style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-bottom-style: none; border-bottom-width: medium" width="1%">&nbsp;</td>
  28. </tr>
  29. <%do while not udatos.eof%>
  30. <tr>
  31. <td style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-bottom-style: none; border-bottom-width: medium" width="8%">
  32. <input name="chk_turno" type="checkbox" value="<%=udatos("cod_proyecto")%>" onclick="document.getElementById('div_li_turno').s tyle. display = (this.checked) ? 'block' : 'none' " ></td>
  33. <td style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-bottom-style: none; border-bottom-width: medium" width="35%">
  34. <font size="3">
  35. <input name="T4" size="25" readonly value="<%=udatos("fecha")%>" style="font-family: Arial; "></font></td>
  36. <td style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-bottom-style: none; border-bottom-width: medium" width="52%">
  37. <font size="3">
  38. <input name="T3" size="72" readonly value="<%=udatos("nombre_proyecto")%>" style="font-family: Arial; "></font></td>
  39. <td style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-bottom-style: none; border-bottom-width: medium" width="2%">
  40. &nbsp;</td>
  41. <td style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-bottom-style: none; border-bottom-width: medium" width="1%">&nbsp;</td>
  42. </tr>
  43. <%udatos.movenext
  44.                loop
  45. %>
  46. </table>
  47. </td>
  48. </tr>
  49. </table>
  50. <input type="submit" value="Traspasar" name="B3"  style="color: #333333">
  51. </form>
  52.  
  53.  

El problema es como los capturo en el array.

Código
  1. <%
  2. dim vector()
  3. vector = Request.Form("chk_turno")
  4.  
  5. Set cn = Server.CreateObject("ADODB.Connection")
  6. cn.Open ("Provider=SQLOLEDB;Server=STGOSQL2K8;Database=IndapCred;Uid=R04; Pwd=R04;")
  7.  
  8. for i=0 to UBound(vector)
  9. Response.Write vector
  10.  
  11. next
  12.  
  13.  
  14. %>
  15.  
  16.  

Gracias por la ayuda.


Título: Re: Capturar datos de checkbox
Publicado por: noele1995 en 8 Septiembre 2013, 16:10 pm
Esto no es VB6 subforo equivocado.