data won't post???

Discussion in 'ASP General' started by Jim Wood, May 30, 2005.

  1. Jim Wood

    Jim Wood Guest

    I cannot figure out what is wrong here. I have a search results page that
    sends the objRst("ID") to the item_media page:

    <td>
    <a href="../order/item_media.asp?Id=<%=objRst("Id")%>"> Add To
    Cart</a>
    </td>

    I will be adding options to select additional characeristics later, but for
    now nothing else happens, the ID should just pass from the item_media.asp
    page to the order_add.asp with this statement:


    <form method="POST" action="order_add.asp" name="Order">


    order_add.asp adds the ID to the shopping cart dictionary:


    Sub AddItemToCart(ItemId, ItemQuantity)

    If Session("Cart").Exists(ItemId) Then
    Session("Cart")(ItemId) = Session("Cart")(ItemId) + ItemQuantity
    Else
    Session("Cart").Add ItemId, ItemQuantity
    End If

    End Sub

    ' Using a dictionary to be able to name the keys to correspond to the
    ' item numbers and then use their value to hold the quantity.
    If Not IsObject(Session("Cart")) Then
    Set Session("Cart") = Server.CreateObject("Scripting.Dictionary")
    End If

    ItemID = Request("ID")
    ItemQuantity = 1

    AddItemToCart ItemId, ItemQuantity

    Response.Redirect "order.asp"


    and from there it is redirected to order.asp to display all the items in the
    basket:


    <%
    If IsObject(Session("Cart")) Then

    For Each Key in Session("Cart")

    objRst.Open "SELECT * FROM tape_list WHERE Id = " & Key, objConn
    %>

    I keep getting an "Syntax error (missing operator) in query expression 'Id
    ='.
    /Sermons/order/order.asp, line 48" which is the objRst Open "SELECT..
    statement above. I *think* the ID is not getting added to the shopping cart,
    but I can't tell for sure. If I remove the item_media.asp form from the
    flow, it works perfectly. Can anyone see what I'm missing? I don't
    understand why the word "key" is used, is it significant or just convienent?
    I don't see it defined or dim'd elsewhere.

    you can see this page at www.bookfixer.com/prototype/

    Thank you for any help you can provide.

    Jim
     
    Jim Wood, May 30, 2005
    #1
    1. Advertising

  2. Jim Wood

    Adrienne Guest

    Gazing into my crystal ball I observed "Jim Wood" <>
    writing in news::

    > I cannot figure out what is wrong here. I have a search results page
    > that sends the objRst("ID") to the item_media page:
    >
    > <td>
    > <a href="../order/item_media.asp?Id=<%=objRst("Id")%>"> Add
    > To
    > Cart</a>
    > </td>
    >
    > I will be adding options to select additional characeristics later, but
    > for now nothing else happens, the ID should just pass from the
    > item_media.asp page to the order_add.asp with this statement:
    >
    >
    ><form method="POST" action="order_add.asp" name="Order">
    >
    >
    > order_add.asp adds the ID to the shopping cart dictionary:
    >
    >
    > Sub AddItemToCart(ItemId, ItemQuantity)
    >
    > If Session("Cart").Exists(ItemId) Then
    > Session("Cart")(ItemId) = Session("Cart")(ItemId) + ItemQuantity
    > Else
    > Session("Cart").Add ItemId, ItemQuantity
    > End If
    >
    > End Sub


    Where are you referencing the id? If you are sending the id in a
    querystring, then you need to get it from the querystring collection and
    probably put it in an hidden field before you do the post to another page.
    Then that page can look at the request.form collection to get the id.

    >
    > ' Using a dictionary to be able to name the keys to correspond to the
    > ' item numbers and then use their value to hold the quantity.
    > If Not IsObject(Session("Cart")) Then
    > Set Session("Cart") = Server.CreateObject("Scripting.Dictionary")
    > End If
    >
    > ItemID = Request("ID")
    > ItemQuantity = 1
    >
    > AddItemToCart ItemId, ItemQuantity
    >
    > Response.Redirect "order.asp"
    >
    >
    > and from there it is redirected to order.asp to display all the items
    > in the basket:
    >
    >
    ><%
    > If IsObject(Session("Cart")) Then
    >
    > For Each Key in Session("Cart")
    >
    > objRst.Open "SELECT * FROM tape_list WHERE Id = " & Key, objConn
    > %>
    >
    > I keep getting an "Syntax error (missing operator) in query expression
    > 'Id
    >='.
    > /Sermons/order/order.asp, line 48" which is the objRst Open "SELECT..
    > statement above. I *think* the ID is not getting added to the shopping
    > cart, but I can't tell for sure. If I remove the item_media.asp form
    > from the flow, it works perfectly. Can anyone see what I'm missing? I
    > don't understand why the word "key" is used, is it significant or just
    > convienent? I don't see it defined or dim'd elsewhere.
    >
    > you can see this page at www.bookfixer.com/prototype/


    <% 'Response.Redirect "welcome.htm" %>

    >
    > Thank you for any help you can provide.
    >
    > Jim
    >
    >
    >
    >




    --
    Adrienne Boswell
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne, May 31, 2005
    #2
    1. Advertising

  3. Jim Wood

    Jim Wood Guest

    "Adrienne" <> wrote in message
    news:Xns9666CD9AEDBAAarbpenyahoocom@207.115.63.158...
    > Gazing into my crystal ball I observed "Jim Wood" <>
    > writing in news::
    >
    >> I cannot figure out what is wrong here. I have a search results page
    >> that sends the objRst("ID") to the item_media page:
    >>
    >> <td>
    >> <a href="../order/item_media.asp?Id=<%=objRst("Id")%>"> Add
    >> To
    >> Cart</a>
    >> </td>
    >>
    >> I will be adding options to select additional characeristics later, but
    >> for now nothing else happens, the ID should just pass from the
    >> item_media.asp page to the order_add.asp with this statement:
    >>
    >>
    >><form method="POST" action="order_add.asp" name="Order">
    >>
    >>
    >> order_add.asp adds the ID to the shopping cart dictionary:
    >>
    >>
    >> Sub AddItemToCart(ItemId, ItemQuantity)
    >>
    >> If Session("Cart").Exists(ItemId) Then
    >> Session("Cart")(ItemId) = Session("Cart")(ItemId) + ItemQuantity
    >> Else
    >> Session("Cart").Add ItemId, ItemQuantity
    >> End If
    >>
    >> End Sub

    >
    > Where are you referencing the id? If you are sending the id in a
    > querystring, then you need to get it from the querystring collection and
    > probably put it in an hidden field before you do the post to another page.
    > Then that page can look at the request.form collection to get the id.
    >
    >>
    >> ' Using a dictionary to be able to name the keys to correspond to the
    >> ' item numbers and then use their value to hold the quantity.
    >> If Not IsObject(Session("Cart")) Then
    >> Set Session("Cart") = Server.CreateObject("Scripting.Dictionary")
    >> End If
    >>
    >> ItemID = Request("ID")
    >> ItemQuantity = 1
    >>
    >> AddItemToCart ItemId, ItemQuantity


    this is where I am trying to grab the ID -- ItemID = Request("ID") -- it
    works just fine from:
    <a href="../order/item_media.asp?Id=<%=objRst("Id")%>"> Add To Cart</a>
    on the sending form, but not when the sending form uses:
    <form method="POST" action="order_add.asp" name="Order">
    I'll try the hidden field and see if that will work.

    >>
    >> Response.Redirect "order.asp"
    >>
    >>
    >> and from there it is redirected to order.asp to display all the items
    >> in the basket:
    >>
    >>
    >><%
    >> If IsObject(Session("Cart")) Then
    >>
    >> For Each Key in Session("Cart")
    >>
    >> objRst.Open "SELECT * FROM tape_list WHERE Id = " & Key, objConn
    >> %>
    >>
    >> I keep getting an "Syntax error (missing operator) in query expression
    >> 'Id
    >>='.
    >> /Sermons/order/order.asp, line 48" which is the objRst Open "SELECT..
    >> statement above. I *think* the ID is not getting added to the shopping
    >> cart, but I can't tell for sure. If I remove the item_media.asp form
    >> from the flow, it works perfectly. Can anyone see what I'm missing? I
    >> don't understand why the word "key" is used, is it significant or just
    >> convienent? I don't see it defined or dim'd elsewhere.
    >>
    >> you can see this page at www.bookfixer.com/prototype/
    >>
    >>
    >> Thank you for any help you can provide.
    >>
    >> Jim
    >>
    >>
    >>
    >>

    >
    >
    >
    > --
    > Adrienne Boswell
    > http://www.cavalcade-of-coding.info
    > Please respond to the group so others can share



    Thanks!

    Jim
     
    Jim Wood, May 31, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vishal
    Replies:
    1
    Views:
    677
    Steve C. Orr [MVP, MCSD]
    Dec 21, 2004
  2. Chad
    Replies:
    4
    Views:
    8,343
  3. =?Utf-8?B?Z29yaWxsYQ==?=
    Replies:
    1
    Views:
    774
    Masudur
    May 25, 2007
  4. Hal Vaughan
    Replies:
    4
    Views:
    782
    Hal Vaughan
    Jan 14, 2008
  5. Jim Wood

    data won't post???

    Jim Wood, May 30, 2005, in forum: ASP General
    Replies:
    1
    Views:
    92
    Jim Wood
    May 31, 2005
Loading...

Share This Page