Hi, this may be an easy question, but I put medium since I pasted in so much code.
I haven't run into this before, I've been using this technique a lot with no problem.
(1) A user enters a credit card number in orderform2.asp and submits to orderform3.asp
(2) orderform3.asp uses the Luhn algorithm to see if the credit card number is a valid, and if not runs the errorForm method, which passes all the values back to orderform2.asp.
(3) My problem is that when I type new info into the ccnum text field in orderform2.asp, the value is added on to the previous value, instead of replacing it. And if I keep trying to submit orderform2.asp and return from orderform3.asp, the values keep getting added on to each other, so pretty soon my ccnum field is a string containing a gazillion characters.
Anybody know why this is happening? I thought about forcing the browser to bypass its cache, but I don't think that's what the problem is.
Below is the relevant code for orderform1.asp and orderform2.asp:
<%ccnum= TRIM( Request.Form ( "ccnum" ) )%>
<FORM METHOD="POST" ACTION="orderform3.asp">
<input name="ccnum" size=16 value="<%=Server.HTMLEncode(ccnum)%>">
SUB errorForm ( theError)
<FORM method="post" ACTION="orderform2.asp">
<% FOR EACH item IN Request.Form%>
<INPUT name ="<%=item%>" type="hidden" value="<%=Server.HTMLEncode(Request.Form( item ) )%>">
<INPUT TYPE="submit" value="Return">
FOR i = 1 TO Len(ccnumber)
IF isNumeric(MID(ccnumber, i, 1)) THEN
cleanCCNum=cleanCCNum & MID(ccnumber, i, 1)
FUNCTION validCCNumber (ccnumber)
ccnumber = cleanCCNum(ccnumber)
IF ccnumber = "" THEN
validCCNumber = FALSE
isEven = False
digits = ""
FOR i = Len(ccnumber) TO 1 STEP -1
IF isEven THEN
digits = digits & CINT(MID(ccnumber, i, 1))*2
digits = digits & CINT(MID(ccnumber, i, 1))
isEven = (Not isEven)
checkSum = 0
FOR i = 1 TO Len(digits) STEP 1
checksum = checkSum + CINT(MID(digits, i, 1))
validCCNumber = ((checkSum Mod 10) = 0)
cc= TRIM( Request.Form ( "ccnum" ) )
IF NOT validCCNumber(cc) THEN
errorForm "The credit card number you entered is not valid. Please try again"
Thanks in advance for any help,