Test Foro de elhacker.net SMF 2.1

Programación => .NET (C#, VB.NET, ASP) => Programación General => 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 (html4strict) [Seleccionar]

<script language="javascript">
function noborrar()
{
alert("Para modificar los datos favor de ingresar a sistema SUF.");
}
</script>

<body>
<form method="POST" action="traspaso_suf.asp">
<div align="center">
<table border="0" width="85%" id="table3" cellspacing="0" cellpadding="0">
<tr>
<td align="center">
<table border="1" width="100%" id="table4" style="border-left-width: 0px; border-right-width: 0px" bgcolor="#FFFFCC">
<tr>
<td colspan="5" bgcolor="#000080" style="border-style: solid; border-width: 1px">
<b><font face="Arial" size="2" color="#FFFFFF">Proyectos en
SUF (<%Response.Write r_usuario%>) </font></b></td>
</tr>
<tr>
<td style="border-style: none; border-width: medium" width="8%">
Selección</td>
<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%">
Fecha</td>
<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%">
Nombre del Proyecto</td>
<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%">
&nbsp;</td>
<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>
</tr>
<%do while not udatos.eof%>
<tr>
<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%">
<input name="chk_turno" type="checkbox" value="<%=udatos("cod_proyecto")%>" onclick="document.getElementById('div_li_turno').s tyle. display = (this.checked) ? 'block' : 'none' " ></td>
<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%">
<font size="3">
<input name="T4" size="25" readonly value="<%=udatos("fecha")%>" style="font-family: Arial; "></font></td>
<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%">
<font size="3">
<input name="T3" size="72" readonly value="<%=udatos("nombre_proyecto")%>" style="font-family: Arial; "></font></td>
<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%">
&nbsp;</td>
<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>
</tr>
<%udatos.movenext
                loop
%>
</table>
</td>
</tr>
</table>
<input type="submit" value="Traspasar" name="B3"  style="color: #333333">
</form>



El problema es como los capturo en el array.

Código (asp) [Seleccionar]

<%
dim vector()
vector = Request.Form("chk_turno")

Set cn = Server.CreateObject("ADODB.Connection")
cn.Open ("Provider=SQLOLEDB;Server=STGOSQL2K8;Database=IndapCred;Uid=R04; Pwd=R04;")

for i=0 to UBound(vector)
Response.Write vector

next


%>



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.