Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Calculation

Status
Not open for further replies.

briggsc

Technical User
Jan 1, 2005
14
US
Hi, I've created a form where the form field integer values are added to create and display a total once submitted, but my form is displaying a Mismatch error. Do anyone have any suggestions? Thanks for your help! Here's the code.

<% dim field1, field2, field3
field1 = request.form("field1")
field2 = request.form("field2")
field3 = request.form("field3")
total = field1*1 + field2*1 + field3*1
%>

<form action="untitled2.asp" method="post">
Field 1:&nbsp;&nbsp;<input type="text" name="field1"><BR><BR>
Field 2:&nbsp;&nbsp;<input type="text" name="field2"><BR><BR>
Field 3:&nbsp;&nbsp;<input type="text" name="field3"><BR><BR>
<input type="Submit" value="Submit">
<br><BR><BR>
<%=total%>
 
you have to check if it is a number and is not empty before you use CINT.

www.sitesd.com
ASP WEB DEVELOPMENT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top