Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
cart.asp
<%
if not isObject(Session("cart")) then
set Session("cart")=Server.CreateObject("Scripting.Dictionary")
end if
add=Request("add")
qty=Request("qty")
del=Request("del")
if add<>"" then
'check if data is no there
if not Session("cart").Exists(add) then 'add to cart
'get data from database this example is without
set recData=Server.CreateObject("Scripting.Dictionary")
recData.Add "cart_no",add
recData.Add "qty",1
recData.Add "price",100
'store the cart to it's cart_no
Session("cart").Add add,recData
else 'flight_id exists
'add only the qty
Session("cart")(add)("qty")=Session("cart")(add)("qty")+CInt(qty)
end if
end if
if del<>"" then
'remove from cart
Session("cart").Remove(del)
end if
'store back to session object
'here display your cart
if IsObject(Session("cart")) then
if Session("cart").Count>0 then
cartItems=Session("cart").Items
For i=Lbound(cartItems) to Ubound(cartItems)
cart_no=cartItems(i)("cart_no")
price=cartItems(i)("price")
qty=cartItems(i)("qty")
Response.Write (i+1)&": "&cart_no&" - "&price&" - "& qty &"<br>"
Next
else
Response.Write ("ur cart is empty")
end if
end if
%>
How to use
cart.asp?add=101 - will add this rec id into cart
cart.asp?add=101&qty=2 - will add 2 to qty of the 101
cart.asp?del=101 - will remove this cart