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") %>