check box usage

Source: Internet
Author: User
Tags date array include split
check box

<input type= "checkbox" name= "checkbox" Value= "a" >
<input type= "checkbox" name= "checkbox" value= "B" >
<input type= "checkbox" name= "checkbox" Value= "C" >
<input type= "checkbox" name= "checkbox" value= "D" >

In this case, the Name property of the check box is the same, so that a control array is created, and when returned back to the background, the selected checkbox is connected in sequence with "," and if we select B and C, then use
Response.Write Request ("checkbox") returns the B,c

You can use split to isolate an array, for example
Bb=split (Request ("checkbox")
For each B in BB
Response.Write b
Next

This shows the value of the selected checkbox.

Case: multi-directional deletion!
Test passed
<% @LANGUAGE = "VBSCRIPT" codepage= "936"%>

<!--#include file= "conn.asp"-->
<%
Set Rs=server. CreateObject ("Adodb.recordset")
Sql= "SELECT * from class ORDER by date Desc"
Rs.Open sql,conn,1,1
If Rs.eof Then
Response. Write ("no Class")
Response.End
End If

%>
<title>untitled document. Lt;/title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<link href= ". /css/fe.css "rel=" stylesheet "type=" Text/css ">
<script >
function Yesno ()
{
Return confirm ("will delete all members and message information, are you sure you want to delete the class?");
}
</script>

<body leftmargin= "0" topmargin= "0" >


<table width= "border=" 0 "cellpadding=" 0 "cellspacing=" 0 ">
<tr>
&LT;TD width= "height=" align= "center" >i d</td>
&LT;TD height= align= "Center" > class name </td>
&LT;TD width= "height=" align= "Center" > Registration date </td>
&LT;TD height= align= "center" > Number </td>
&LT;TD align= "center" > Delete? </td>
</tr>
<%
While not rs.eof
%>
<form name= "Form2" method= "post" action= "dec.asp" ><tr>
&LT;TD width= "height=" align= "Center" >
<input type= "checkbox" Name= "id" value= "<%=rs (" ClassID ")%>" >
</td>
&LT;TD width= "height=" align= "Center" ><%=rs ("classname")%></td>
&LT;TD width= align= "center" ><%=rs ("date")%></td>
&LT;TD width= "height=" align= "Center" ><%=rs ("num")%></td>
&LT;TD width= "height=" align= "center" ></td>
</tr><%rs.movenext
Wend
Rs.close
Set rs=nothing
Conn.close
Set conn=nothing
%>
<tr>
&LT;TD height= align= "center" > </td>
&LT;TD height= align= "center" > </td>
&LT;TD align= "center" > </td>
&LT;TD height= align= "center" > </td>
&LT;TD height= align= "center" >
<input type= "Submit" name= "submit" value= "Delete" ></form>
</td>
</tr>

</table>

</body>

Dec.asp


<% @LANGUAGE = "VBSCRIPT" codepage= "936"%>
<!--#include file= "conn.asp"-->
<title>untitled document. Lt;/title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">

<body>
<%
Sql= "DELETE from class WHERE ClassID in (" & Request.Form ("id") & ")"
Conn.execute (SQL)%>
</body>


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.