ASP checkbox check box whether the code is selected (combined with the database)

Source: Internet
Author: User

Sometimes, check boxes are used on the webpage, that is, multiple selection boxes. When a user submits input information, we obtain the content of the check box and save it to the database, for example, the personal information entered by the user is often used. However, after the user submits the request, the user may need to modify it. Therefore, we need to read the form data from the database. This requires that the user's previous input status be displayed, however, it is difficult to read from the database whether the check box is selected. So today we will teach you how to read the check box selected from the database through ASP. I hope you can share some other ideas with me.

The Code is as follows:

Copy codeThe Code is as follows: <%
Document = Split (rs ("document"), ",") 'the comma here depends on the delimiter you saved to the database.
Function check (temp)
Check = ""
For I = 0 To UBound (document)
If temp = document (I) Then
Check = "checked"
End if
Next
End Function
%>
<Input name = "checkbox" type = "checkbox" value = "asp" <% = check ("asp") %>
<Input name = "checkbox" type = "checkbox" value = "java" <% = check ("java") %>
<Input name = "checkbox" type = "checkbox" value = "php" <% = check ("php") %>

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.