<ColFmt_>
<tr>
<td>
<input type="checkbox" name="EmpId"  id="EmpId" value="^ColValue.1^">^ColValue.2^</td>
</tr>
</ColFmt_> 传递到下一个页面时候,都是EmpId=1,EmpId=2,EmpId=3,
我想吧这些1,2,3插入到数据库之中去,该怎么调用?

解决方案 »

  1.   

    其实不用这么麻烦,直接复选框用一个名字就可以了,然后循环读出来就可以了
    <input type="checkbox" name="EmpId" value="<%=rs("ColValue")%>">
    提交到asp页面可以用split截取存到数组中
    a=split(request.form("EmpId"),",")
    for i=0 to ubound(a)-1
     response.write a(i)
    next
    这样就可以读出来复选框选中的值
      

  2.   

    我用的是javascript,和sybase数据库,有没有相应的方法?
      

  3.   

    为了保证能够运行,省略了检索数据库的部分。相信楼主能够解决。下面代码中,a.asp文件的变量"ingcount"就相当于数据集中的记录条数。为了取到这个这个值,下例中采用了hidden传值的方法,当然也可以在第二个页面中再检索一次数据库取出该值。请参考~~~------- a.asp --------<html>
        <head>
            <script language="javascript">
            <!--
                function fun_chk(ingSav)
                {
                    var strNote;
                    strNote = document.form1.all['C'+ingSav].checked;
                    document.form1.all['H'+ingSav].value = strNote;
                }
            //-->
            </script>
        </head>
        <body>
            <form name=form1 method=post action="b.asp">
            <p><input type=submit></p>
            <% Dim ingcount
               For ingcount = 0 To 2 %>
                <input type="checkbox" name="C<%=ingcount%>" value="0" onclick="fun_chk(<%=ingcount%>);">A<%=ingcount%>
                <input type="hidden" name="H<%=ingcount%>">
            <% Next %>
            <input type=hidden name=HI value=<%=ingcount%>>
            </form>
        </body>
    </html>------------- b.asp ----------------<%
        Dim strcheck()
        Dim ingcount
        Dim ingCC
        ingcount = CInt(Trim(Request.Form("HI")))
        For ingCC = 0 To ingcount-1
            Redim Preserve strcheck(ingcount)
            If (Request.Form("H"&ingCC)) = "true" Then strcheck(ingCC) = "checked"
            If (Request.Form("H"&ingCC)) = "false" Then strcheck(ingCC) = ""
        Next
    %>
    <html>
        <% For ingCC = 0 To ingcount-1 %>
        <input type=checkbox value=ingcount <%=strcheck(ingCC)%>>A<%=ingCC%>
        <% Next %>
    </html>
      

  4.   

    sorry第二个文件中有错误,<input type=checkbox name="C<%=ingCC %>" <%=strcheck(ingCC)%>>A<%=ingCC%>
      

  5.   

    <%rs=server.createobject("adodb.recordset")
      sqlstr=.....
      rs.open sqlstr,conn,1,1
      while not rs.eof%>
    <input type="checkbox" name="wangbin" value=<%=rs("id")%><%=rs("mc")%><br>
    <%rs.movenext
      wend%>在下面的页面中
    <%arr=split(request("wangbin"),",")
      arr_size=ubound(arr)%>
    往下你怎么处理就看你了