I have a session variable made up using the following code to keep a shopping basket type of arrangement
I have a page that deletes a single item using the following
I am now tring to make a page that empties all the contents of the session variable in one click, i have tried the following
None of these work and do not empty my variable
can anyone advise where i am going wrong??
Thanks
Code:
<%
if InStr(session("recordsInCart"), ","&request.form("recordNum")) = 0 then
session("recordsInCart") = session("recordsInCart") + request.form("recordNum") &","
else
'do nothing
end if
%>
Code:
<%
If Not request.form("recordNum") ="" Then
CartItems = split(session("recordsInCart") ,",")
For Each Item in CartItems
If Not Item = request.form("recordNum") Then
If IsNumeric(Item) then newitems = newitems & Item & ","
End If
Next
session("recordsInCart") = left(newitems, len(newitems)) 'remove trailing comma from each loop iteration
End If
%>
Code:
Session("recordsInCart") = ""
Session.Abandon
Session.Contents.RemoveAll()
can anyone advise where i am going wrong??
Thanks
Comment