jeudi 2 mars 2017

Split data and checked in checkbox value from database classic asp

Please help. The following code run well but create duplicate values. How do I fix the problem. I think I put split function in wrong place.

customer_choice=request.QueryString("customer_choice")

strSQL="Select distinct computer_name from item"
rs.Open strSQL, adoCon,1,1
rs.MoveFirst
    while not rs.EOF
        abc=split(customer_choice,",")
        for i=0 to UBound(abc)  
        if rs("computer_name")=abc(i) then
        response.Write("<input type='checkbox' id='c1' name='c1' value='" & rs("district") & "' checked>" & rs("computer_name") & "</input>")
        else
        response.Write("<input type='checkbox' id='c1' name='c1' value='" &   rs("computer_name") & "'>" & rs("computer_name") & "</br></input>")   
        end if
        next
        rs.MoveNext 
    wend
    rs.Close




Aucun commentaire:

Enregistrer un commentaire