data won't post???

J

Jim Wood

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
 
A

Adrienne

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.
 
J

Jim Wood

Adrienne said:
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.

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>


Thanks!

Jim
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top