Cookies Don't Work!!!

Results 1 to 2 of 2

Thread: Cookies Don't Work!!!

  1. #1
    Join Date
    Dec 1969

    Default Cookies Don't Work!!!

    Hello Everyone,<BR>My name is Peter. I have some problems about cookies in ASP. Please give me a hand. It would be greatly appreciated!<BR><BR>I am learning how to create E-Commerce. I create a little bookstore. You can view it at:<BR><BR>Every thing is working all right, but COOKIES – DELETE DOESN’T WORK AND QUANTITY FIELD DOESN’T SHOW A NUMBER UP. The problems start from cart.asp page (after “Add To Your Cart” button is clicked).<BR><BR>1./ When “Add To Your Cart” button is clicked, it will go to AddToCart.asp.<BR>In this page, I write:<BR>&#060;%<BR>Dim ISBN1, quantity <BR>ISBN1 = cstr(Request("myHidden")) <BR>Response.Cookies("AddToCartCookie")(ISBN1) = quantity<BR>Response.Redirect("cart.asp")<BR>%&#06 2;<BR>Then, cart.asp page shows up again. The shopping cart generates by 1 and the book I choose is shown in the cart.asp page.<BR>A little thing I’d like to note here is when I try to see what the “quantity” is by writing Response.Write quantity, it doesn’t return anything!!!??? Would you please show me what are wrong and how to fix that.<BR><BR>2./ In cart.asp page, there is a Quantity column with a little field for a number, but a number such as 1 or 2 doesn’t show up.<BR>In order to get a quantity number of books which has added to cart, I write codes for this like below:<BR>&#060;%<BR>….<BR>Dim strISBN, iQuantity<BR>For each strISBN in Request.Cookies("AddToCartCookie") <BR>iQuantity = Request.Cookies("AddToCartCookie")(strISBN)<BR>Res ponse.Write “iQuantity = “ iQuantity<BR>…….<BR>Response.write("&#060;td align=&#039;center&#039;&#062;&#060;input type=&#039;textfield&#039; value="""&iQuantity&""" name=&#039;quantity&#039; size=2 maxlength=2&#062;&#060;/td&#062;")<BR>……<BR>%&#062;<BR>The Response.Write iQuantity returns nothing and the value in iQuantity shows nothing in the Quantity column.<BR>Would you please show me what are wrong and how to fix that.<BR><BR>3./ I write codes to delete books: (FormAction.asp)<BR>In cart.asp page, I create Delete button to delete books. Every time the Delete button is clicked, it will go to FormAction.asp page. In this page, I write:<BR>&#060;%<BR>Dim ISBN1, quantity <BR>ISBN1 = cstr(Request("myHidden"))<BR>Response.Cookies("Add ToCartCookie")(ISBN1)= 0<BR>Response.Redirect("cart.asp") <BR>%&#062;<BR>It will redirect to Cart.asp, but it doesn’t work! If it were right, after the Delete button is click, that recordset will be disappeared and the quantity in the Shopping Cart will be decreased by 1. But when I try to delete, the record is still there. One thing changed is quantity = 0.<BR>Would you please show me what are wrong and how to fix that.<BR><BR>4./ I write codes to count quantity showing near the shopping cart on the top of the page.<BR>&#060;%<BR>Dim quantity <BR>quantity = 0<BR>Dim mybook<BR>For each mybook in Request.Cookies("AddToCartCookie") <BR>if mybook &#060;&#062; "" then <BR>quantity = quantity + 1 <BR>end if <BR>Next <BR>Response.Write quantity<BR>%&#062;<BR><BR>It generates all right.<BR><BR>Please give me a hand. It would be greatly appreciated.<BR>I am looking forward to hearing from everyone.<BR><BR>Best regards,<BR>Peter<BR><BR>PS.<BR>About the cstr(Request("myHidden")):<BR>I have a little JavaScript to get a value when a button is clicked.<BR>&#060;script&#062;<BR>function test(i) {<BR> document.myForm.myHidden.value = I<BR> document.myform.submit();<BR> }<BR>&#060;/script&#062;<BR>It works all right.<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default *** CROSSPOST ***

    Pleae don&#039;t post the same message/question in more than one forum.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts