gemme checkbox
Jeg udskriver en række checkbokse ud for et ord og an skal kunne slå ordet til eller fra i en database (ja/nej) on off.Min SQL:
If (CStr(Request("MM_update")) = "form1" And CStr(Request("MM_recordId")) <> "") Then
MM_editConnection = MM_ordbog_STRING
MM_editTable = "ordbog"
MM_editColumn = "Id"
MM_recordId = "" + Request.Form("MM_recordId") + ""
MM_editRedirectUrl = "ordbog.asp"
MM_fieldsStr = "checkbox|value"
MM_columnsStr = "broadcast|none,1,0"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Update Record: construct a sql update statement and execute it
If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then
' create the sql update statement
MM_editQuery = "update " & MM_editTable & " set "
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_editQuery = MM_editQuery & ","
End If
MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
Next
MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId
If (Not MM_abortEdit) Then
' execute the update
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
Mit output ser sådan ud:
De hedder alle name="checkbox" value="checkbox">
uddrag af koden->>
Forskellen mellem to talstørrelser. <br>
<font color="#666666" size="1"> </font>
</span>
<strong><A HREF="ordbogprint_edit.asp?ord=Absolut+v%E6rdi">Absolut værdi</A></strong>
<input type="checkbox" name="checkbox" value="checkbox">
<font color="#666666" size="1">
</font><br>
(se numerisk værdi). <br>
<font color="#666666" size="1"> </font>
</span>
<strong><A HREF="ordbogprint_edit.asp?ord=Accelerationsvirkningen">Accelerationsvirkningen</A></strong>
<input type="checkbox" name="checkbox" value="checkbox">
<font color="#666666" size="1">
</font><br>
Det forhold, at efterspørgselsændringer efter færdigvarer forårsager ændringer i investeringsomfanget der er kraftigere end ændringen i efterspørgslen efter færdigvarer. <br>
<font color="#666666" size="1"> </font>
</span>
<strong><A HREF="ordbogprint_edit.asp?ord=Accept">Accept</A></strong>
<input type="checkbox" name="checkbox" value="checkbox">
<font color="#666666" size="1">
osv. 5000 linier
Hvordan får jeg den til at opdatere disse checkbokse?
Den skal jo ikke bruge et ID men alles id?
den skal løbe igennem hele smøren og gemme dem som er checked.
