Click to See Complete Forum and Search --> : Display Error in IE


tgl@bug
03-30-2005, 10:51 PM
i had required user to enter related information to make their payment in payment.asp.then only i checked the information in check.asp. im using ODBC method to link to database.Somehow, these 2 pages can run correctly before,but after changing the interface,the check.asp couldn't run correctly as it should be...

here is the check.asp code:

'capture those information
bank = request.form("institute")
.
.
'validate it

if bank = "" then
errmsg = "please select your bank type"
elseif type = "" then
errmsg = "please select your card type"
elseif cardno = "" then
errmsg = "please enter your credit card number"
elseif not isNumeric(cardno) then
errmsg = "Credit card number only allowed numeric"
elseif password = "" then
errmsg = "please enter your password"
End if

'set the connection
---------------


sql = "select * from password where institute = "&bank&'" And CardType = "&type

if password <> rs("Password") then
errmsg = "this is not a valid password"
end if

if errmsg = "" then

%>
<html>
<body>

you have successfully made the payment!

</body>
</html>

<%
elseif
%>

<html>
<body>
<form method = "post" action = "payment.asp">
there is some problem with your information
<blockquote><%=errmsg%></blockquote>
<input type = "hidden" name = "bank" value = "<%=bank%>">
<input type = "hidden" name = "type" value = "<%=type%>">
<input type = "hidden" name = "cardno" value = "<%=cardno%>">
<input type = "hidden" name = "password" value = "<%=password%>">
<input type = "Submit" name = "submit" value = "return">

</form></body></html>

<%
End If
%>


the problem is everytime i load this page,it must contain information for "cardno" before its checking.if user didn't enter that information,the page can not open.

but before i change the interface,everything jz fine in running the program.

Thank for those kindly reply..

phpnovice
03-31-2005, 12:45 AM
You need more of these:

bank = request.form("institute")

One for each field in your form -- only "institute" is not in your form.

tgl@bug
03-31-2005, 01:16 AM
do u mean get all the information from previus page and post it here?

i did.i do hav capture all the information from previous page but i didn't type out all of it.

For sure,capturing of data is no problem,but only the sequence of following checking for those field is not as i type. i mean i have check from "bank" to "password", but why it must checked my "cardno" first before it goes to others?

phpnovice
03-31-2005, 08:59 AM
Are you talking about this code here not working correctly?

if bank = "" then
errmsg = "please select your bank type"
elseif type = "" then
errmsg = "please select your card type"
elseif cardno = "" then
errmsg = "please enter your credit card number"
elseif not isNumeric(cardno) then
errmsg = "Credit card number only allowed numeric"
elseif password = "" then
errmsg = "please enter your password"
End if

Explain more, please.

tgl@bug
04-10-2005, 12:20 PM
i fix the problem already......thx

tgl@bug
04-10-2005, 12:32 PM
but now i had another problem.

i should let user choose which items in the shopping cart they like to paid...so wat should i do?Here the code in the page called DisplayCart.asp


<%
'----------------------------------------------------------
' name: AddItemToCart()
'----------------------------------------------------------
Sub AddItemToCart()

Dim itemNumber
dim ID, price, Name
dim productQuantity, itemSubTotal

'If Shopping Cart doesn't already exist, then create it
If IsEmpty(Session("ShoppingCart")) Then

Session("ShoppingCart") = ShoppingCart

Session("ItemCount") = 0

Else

'Set the local array equal to the session shopping cart
ShoppingCart = Session("ShoppingCart")

End If

'Load value of item count session variable into a variable
itemNumber = Session("ItemCount")

'Get item info from hidden elements
ID = request.form("hidID")
Name = request.form("hidName")
price = request.form("hidPrice")


'Get user chosen quantity
productQuantity = request.form("txtQuantity")

'We will assume that if they left out quantity, they just want one
if productQuantity = "" then
productQuantity = 1
end if

'Calculate item subtotal
itemSubTotal = price * productQuantity

'Add chosen item to Local array
ShoppingCart(PRODUCT_ID, itemNumber) = ID
ShoppingCart(PRODUCT_NAME, itemNumber) = Name
ShoppingCart(PRODUCT_PRICE, itemNumber) = price
ShoppingCart(PRODUCT_QUANTITY, itemNumber) = productQuantity
ShoppingCart(ITEM_SUBTOTAL, itemNumber) = itemSubTotal

'Set Session Shopping Cart equal to the local array
Session("ShoppingCart") = ShoppingCart

'Increment item count session variable
Session("ItemCount") = Session("ItemCount") + 1

End Sub

'----------------------------------------------------------
' name: DisplayCartContents()
'----------------------------------------------------------
Sub DisplayCartContents()

dim i
dim itemsInCart, totalCost
dim itemNumber
dim ID, price, Name, productQuantity, itemSubTotal

%>
<h1>Your Shopping Cart Contents:</h1>

<hr>
<br><br>
<table cellspacing="2" cellpadding="2" border="1" width="100%" heigth="500">

<tr>
<td>Product ID</td>
<td>Product Name</td>
<td>Price</td>
<td>Quantity</td>
<td>Item SubTotal</td>
</tr>
<%
'Initialize counter
totalCost = 0

'Get number of courses currently in the user's schedule
itemsInCart = Session("ItemCount")

'Display the contents of the Session Shoppping Cart
for itemNumber = 0 to itemsInCart

if ShoppingCart(0, itemNumber) <> "" then

'Get values from shopping cart
ID = ShoppingCart(PRODUCT_ID, itemNumber)
Name = ShoppingCart(PRODUCT_NAME, itemNumber)
price = ShoppingCart(PRODUCT_PRICE, itemNumber)
productQuantity = ShoppingCart(PRODUCT_QUANTITY, itemNumber)
itemSubTotal = ShoppingCart(ITEM_SUBTOTAL, itemNumber)

'Sum total cost
totalCost = totalCost + itemSubTotal

%>
<tr>
<td><%= ID %>&nbsp;</td>
<td><%= Name %>&nbsp;</td>
<td><%= FormatCurrency(price) %>&nbsp;</td>
<td align=middle><%= productQuantity %>&nbsp;</td>
<td align=middle><%= FormatCurrency(itemSubTotal) %>&nbsp;</td>
</tr>
<%
End If

next
%>
</table>

<br><br>
Number of Time You Display Shopping Cart = <%= itemsInCart %> <br>
<h3>Order Total = <%= FormatCurrency(totalCost) %></h3>



<p>&nbsp;</p>
<form method="POST" action="placeid.asp">
<input type="submit" value="Continue" name="B1"></p>
</form>



</body>
</html>


<%
End Sub

'------------------------------------------
'END OF PROCEDURES AND START OF MAIN CODE
'------------------------------------------


'Add the chosen course to the cart
Call AddItemToCart()

'Display contents of electronic shopping cart
Call DisplayCartContents()

%>

phpnovice
04-10-2005, 02:03 PM
Send them a FORM with a checkbox on each row for them to indicate which rows to process.