Where's your code that gets the userID from the
cookie? I don't see it.
Mark
--- k4t_9283 <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am really desperate!!
>
> I have been using a book "Teach Yourself E-Commerce
> Programming with
> ASp in 21 days" published by Sams to create an
> online store as part
> of
> a project.
>
> using the code provided I have tried to construct a
> 'doCheckout' page
> but the code isn't working properly.
>
> When a user first visits the site and tries to
> purchase something,
> they
> have to register. When they have registered, a
> cookie is placed on
> their machine with their username and password.
>
> The 'addCart' page obtains the user's username and
> displays it on the
> page along with their shopping cart. When the user
> clicks 'Checkout'
> they are supposed to be taken to the 'docheckout'
> page. However, this
> page is not picking up the user's username or
> user_id and I have
> tried
> everything I can think of so was hoping someone
> might be able to shed
> some light on it??
>
> Here's the original 'doCheckout' page:
>
>
========================================================
>
> <%
> ' Retrieve Registration Information
> sqlString = "SELECT * FROM users " &_
> "WHERE user_id=" & userID
> SET RS = Con.Execute( sqlString )
> IF NOT RS.EOF THEN
> street = RS( "user_street" )
> city = RS( "user_city" )
> state = RS( "user_state" )
> zip = RS( "user_zip" )
> cctype = RS( "user_cctype" )
> ccnumber = RS( "user_ccnumber" )
> ccexpires = RS( "user_ccexpires" )
> ccname = RS( "user_ccname" )
> END IF
>
> ' Hide Credit Card Number
> ccnumber = LEFT( ccnumber, 2 ) &_
> "************" &_
> RIGHT( ccnumber, 2 )
> %>
> <html>
> <head><title>Checkout</title></head>
> <body>
>
> <center>
> <table border=1 width=500
> cellpadding=5 cellspacing=0>
> <tr>
> <td align="center" bgcolor="lightgreen">
> <b>Confirm Order</b>
> </td>
> </tr>
> <tr>
> <td>
> Your order will be sent to the following address
> and charged to the following credit card.
> Please review your address and payment information
>
> and click Confirm Order to finish placing your
> order.
>
> <form method="post" action="checkout2.asp">
> <input name="username" type="hidden"
> value="<%=username%>">
> <input name="password" type="hidden"
> value="<%=password%>">
> <font face="Arial" size="2" color="darkgreen">
> <p><b>Address Information:</b>
> </font>
> <font face="Courier" size="2">
> <br><b>street:</b>
> <input name="street" size=20 maxlength=50
> value="<%=Server.HTMLEncode( street )%>">
> <br><b>city:</b>
> <input name="city" size=20 maxlength=50
> value="<%=Server.HTMLEncode( city )%>">
> <br><b>state:</b>
> <input name="state" size=20 maxlength=2
> value="<%=Server.HTMLEncode( state )%>">
> <br><b>zip:</b>
> <input name="zip" size=20 maxlength=20
> value="<%=Server.HTMLEncode( zip )%>">
> </font>
> <font face="Arial" size="2" color="darkgreen">
> <p><b>Payment Information:</b>
> </font>
> <font face="Courier" size="2">
> <br><b>type of credit card:</b>
> <select name="cctype">
> <option value="1"
> <%=SELECTED( cctype, "1" )%> > VISA
> <option value="2"
> <%=SELECTED( cctype, "2" )%> >MasterCard
> </select>
> <br><b>credit card number:</b>
> <input name="ccnumber" size=20 maxlength=20
> value="<%=Server.HTMLEncode( ccnumber )%>">
> <br><b>credit card expires:</b>
> <input name="ccexpires" size=20 maxlength=20
> value="<%=Server.HTMLEncode( ccexpires )%>">
> <br><b>name on credit card:</b>
> <input name="ccname" size=20 maxlength=20
> value="<%=Server.HTMLEncode( ccname )%>">
> <p><input type="submit" value="Confirm Order">
> </font>
> </form>
> </tr>
> </table>
>
>
=========================================================
>
> and here's the original 'addCart' page:
>
>
===========================================================
>
> <%
> ' Get Product ID
> productID = TRIM( Request( "pid" ) )
>
>
> ' Add Item to cart
> IF productID <> "" THEN
> sqlString = "SELECT cart_id FROM cart " &_
> "WHERE cart_userID=" & userID & " " &_
> "AND cart_productID=" & productID
> SET RS = Con.Execute( sqlString )
> IF RS.EOF THEN
> sqlString = "INSERT INTO cart ( " &_
> "cart_userID, " &_
> "cart_productID, " &_
> "cart_quantity " &_
> ") VALUES ( " &_
> userID & ", " &_
> productID & ", 1 )"
> ELSE
> sqlString = "UPDATE cart SET " &_
> "cart_quantity=cart_quantity+1 " &_
> "WHERE cart_id=" & RS( "cart_id" )
> END IF
> RS.Close
> SET RS = Nothing
> Con.Execute sqlString
> END IF
>
>
> ' Update Shopping Cart Quantities
> IF Request( "updateQ" ) <> "" THEN
> SET RS = Server.CreateObject( "ADODB.Recordset" )
> RS.ActiveConnection = Con
> RS.CursorType = adOpenDynamic
> RS.LockType = adLockOptimistic
> sqlString = "SELECT cart_id, cart_quantity FROM cart
> " &_
> "WHERE cart_userID=" & userID
> RS.Open sqlString
> WHILE NOT RS.EOF
> newQ = TRIM( Request( "pq" & RS( "cart_id" ) ) )
> IF newQ = "" OR newQ = "0" THEN
> RS.Delete
> ELSE
> IF isNumeric( newQ ) THEN
> RS( "cart_quantity" ) = newQ
> END IF
> END IF
> RS.MoveNext
> WEND
> RS.Close
> SET RS = Nothing
> END IF
>
>
>
>
> %>
> <html>
> <head><title>Shopping Cart</title></head>
> <body bgcolor="white">
>
> <center>
> <font face="Arial" size=3 color="darkgreen">
> <b><%=username%>'s shopping cart:</b>
>
=== message truncated ===
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/