-
Help with HTML Checkbox
Hello. I am trying to make my checkbox delete a row from my SQL database table.
My front end file reads:
Response.Write("<td><input type=checkbox name=Remove " & RecID & " value=Remove></td>")
My back end file reads:
Dim SQL
Dim objRemoteConnTemp
Dim Low
Dim High
Dim Remove
Dim totcnt
Dim cnt
Set objRemoteConnTemp = server.CreateObject("adodb.connection")
objRemoteConnTemp.Open sRemoteConnStr
SQL = "select count(*) cnt FROM Shipping_Discount_Test"
OpenRecordset objRemoteConnTemp, "SQL", SQL, objRs
totcnt = objRS("cnt")
cnt = 1
do while cnt <= totcnt
if Request.QueryString("dropdown" & cstr(cnt))="Free Shipping On" then SQL = "UPDATE Shipping_Discount_Test set freeshipflag=1 WHERE rec_id=" & cnt else SQL = "UPDATE Shipping_Discount_Test set freeshipflag=0 WHERE rec_id=" & cnt
RunSQL objRemoteConnTemp, SQL
if Request.QueryString("Remove" & cstr(cnt)) = "Remove" then SQL = "DELETE FROM Shipping_Discount_Test WHERE rec_id = " & cstr(cnt)
cnt = cnt + 1
loop
How do I make my checkbox remove a row from my SQL database table when I submit it as "checked"?
Thanks.