Ok, I've re-juggled the code so that it scraps the idea of a cookie and
is using a session. I decided that seeing as username is unique anyway,
I would try and work with that, seeing as it is passed from page to
page anyway.
So I finally got the page to load which is great, but the values in the
form aren't loading!
Here's my updated page:
======================================================================
<%
' Store userID in Session variable
Session( "username" ) = username
' Retrieve Registration Information
Set Con = Server.CreateObject( "ADODB.Connection" )
Con.Open "accessDSN"
sqlString = "SELECT * FROM users " &_
"WHERE user_username='" & Session("username") & "'"
SET RS = Con.Execute( sqlString )
IF NOT RS.EOF THEN
street = RS( "user_street" )
city = RS( "user_city" )
county = RS( "user_county" )
postcode = RS( "user_postcode" )
country = RS( "user_country" )
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 - Confirm your Address and Payment
Details</title></head>
<body>
<center>
<table border=0 width=500
cellpadding=5 cellspacing=0>
<tr>
<td align="center" colspan=2 bgcolor="lightgreen">
<font face="Arial" size="3">
<b>Confirm Your Details</b>
</font>
</td>
</tr>
<tr>
<td colspan=2>
<font face="Arial" size="2">
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>
</td>
</tr>
<tr>
<td colspan=2>
<font face="Arial" size="2" color="darkgreen">
<b>Address Information:</b>
</font>
</td>
</tr>
<tr>
<td>
<font face="Arial" size="2">
<b>Street:</b>
</font>
</td>
<td>
<input name="street" size=20 maxlength=50
value="<%=Server.HTMLEncode( street )%>">
</td>
</tr>
<tr>
<td>
<font face="Arial" size="2">
<b>City:</b>
</font>
</td>
<td>
<input name="city" size=20 maxlength=50
value="<%=Server.HTMLEncode( city )%>">
</td>
</tr>
<tr>
<td>
<font face="Arial" size="2">
<b>County:</b>
</font>
</td>
<td>
<input name="county" size=20 maxlength=2
value="<%=Server.HTMLEncode( county )%>">
</td>
</tr>
<tr>
<td>
<font face="Arial" size="2">
<b>Postcode:</b>
</font>
</td>
<td>
<input name="postcode" size=20 maxlength=20
value="<%=Server.HTMLEncode( postcode )%>">
</td>
</tr>
<tr>
<td>
<font face="Arial" size="2">
<b>Country:</b>
</font>
</td>
<td>
<input name="country" size=20 maxlength=2
value="<%=Server.HTMLEncode( country )%>">
</td>
</tr>
<tr>
<td colspan=2>
<font face="Arial" size="2" color="darkgreen">
<b>Payment Information:</b>
</font>
</td>
</tr>
<tr>
<td>
<font face="Arial" size="2">
<b>Type of Credit Card:</b>
</font>
</td>
<td>
<select name="cctype">
<option value="Visa">Visa</option>
<option value="Mastercard">MasterCard</option>
<option value="Switch">Switch</option>
</select>
</td>
</tr>
<tr>
<td>
<font face="Arial" size="2">
<b>Credit Card Number:</b>
</font>
</td>
<td>
<input name="ccnumber" size=20 maxlength=20
value="<%=Server.HTMLEncode( ccnumber )%>">
</td>
</tr>
<tr>
<td>
<font face="Arial" size="2">
<b>Credit Card Expires:</b>
</font>
</td>
<td>
<input name="ccexpires" size=20 maxlength=20
value="<%=Server.HTMLEncode( ccexpires )%>">
</td>
</tr>
<tr>
<td>
<font face="Arial" size="2">
<b>Name on Credit Card:</b>
</font>
</td>
<td>
<input name="ccname" size=20 maxlength=20
value="<%=Server.HTMLEncode( ccname )%>">
</td>
</tr>
<tr>
<td colspan=2>
<input type="submit" value="Confirm Order">
</td>
</tr>
</font>
</form>
</table>
<p>
</body>
</html>
================================================================
When I tried a 'response.write sqlstring' it returned the following:
SELECT * FROM users WHERE user_username=''
which suggests to me that the username isn't working correctly, but it
must be working to a certain degree because my page wouldn't load at
all last time!
> You need to find the name of the cookie that holds the
> value for 'userid' (I accidentally used 'username').
> I didn't see it in the code from your previous email,
> but this might work:
>
> Change this line:
>
> strUserID = Request.Cookies("username")
>
> To this:
> strUserID = Request.Cookies("userID")
>
> If this doesn't work, zip all the files, email them to
> me and I will look at them directly.
>
> Mark
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/