cloudseven
Programmer
hi there I have a checkbox for each item displayed which contains a cartid for each item. When a button is pressed, I have a function which takes all the values of the checked boxes, and go into the database and delete the items matching the cartid. I got it working, but it only works when a single checkbox is clicked. Not multiple ones. Here is my code, thank you. I'll keep playing around with it. Thanks.
***IF ?ACTION=DELETE***
Case "DELETE"
For intCheck = 1 To Request.Form("itemcheck"
.Count
oCart.Remove(Request.Form("itemcheck"
)
next
************************
THIS IS THE FUNCTION BEING CALLED...
Public Function Remove(ByVal itemreference)
'deletes an item from a user's cart
if not bLoaded then
Remove = false
Exit Function
end if
On Error Resume Next
itemreference = clng(itemreference)
If Err Then
Remove = False
Exit Function
End If
On Error GoTo 0
if itemreference = 0 then
Remove = False
Exit Function
end if
On Error Resume Next
c.execute "DELETE FROM ShoppingCart_New WHERE cartitemid = " & _
itemreference & " AND usrsessid = '" & Request.Cookies("user"
& "'"
If Err.Number <> 0 Then
Remove = false
sDBErr = Err.Description
Exit Function
End If
On Error GoTo 0
Remove = True
End Function
***IF ?ACTION=DELETE***
Case "DELETE"
For intCheck = 1 To Request.Form("itemcheck"
oCart.Remove(Request.Form("itemcheck"
next
************************
THIS IS THE FUNCTION BEING CALLED...
Public Function Remove(ByVal itemreference)
'deletes an item from a user's cart
if not bLoaded then
Remove = false
Exit Function
end if
On Error Resume Next
itemreference = clng(itemreference)
If Err Then
Remove = False
Exit Function
End If
On Error GoTo 0
if itemreference = 0 then
Remove = False
Exit Function
end if
On Error Resume Next
c.execute "DELETE FROM ShoppingCart_New WHERE cartitemid = " & _
itemreference & " AND usrsessid = '" & Request.Cookies("user"
If Err.Number <> 0 Then
Remove = false
sDBErr = Err.Description
Exit Function
End If
On Error GoTo 0
Remove = True
End Function