I have an order page set up to write to an access data base, what I would like to do now is have the quantity the user puts in the text field to preform an equasion with the value of the item and then display in the next colum. here is the code,
thanks for any help,
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/Sxrip.asp" -->
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abo
rtEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME")
If (Request.QueryString <> "" Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert") = "add_form" Then
MM_editConnection = MM_Sxrip_STRING
MM_editTable = "scriporder"
MM_editRedirectUrl = ""
MM_fieldsStr = "First_Name|value|Last_Name|value|Family|value| Phone_Number|value|Email|value|Check|value|Credit_card| value|Card_No|value|Card_Expire|value|American_Eagle_25| value|American_Airlines_50|value|Applebees_10|value|Arbys_5| value|ATT_60_min_10|value|ATT_120_min_15|value| Banana_Republic_25|value|Barnes_Nobel_BDalton_10|value"
MM_columnsStr = "First_name|',none,''|Last_Name|',none,''|Family|', none,''|Phone_Number|none,none,NULL|Email|',none, ''|Check|',none,''|credit_card|',none,''|Card_No|none,none, NULL|Card_Expire|',none,''|American_Eagle_25|none, none,NULL|American_Airlines_50|none,none, NULL|Applebees_10|none,none,NULL|Arbys_5|none, none,NULL|ATT_60_min_10|none,none, NULL|ATT_120_min_15|none,none,NULL|Banana_Republic_25|none, none,NULL|Barnes_Nobel_BDalton_10|none, none,NULL"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|"
MM_columns = Split(MM_columnsStr, "|"
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "" Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "" Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
Dim MM_tableValues
Dim MM_dbValues
If (CStr(Request("MM_insert") <> "" Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),","
MM_delim = MM_typeArray(0)
If (MM_delim = "none" Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none" Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none" Then MM_emptyVal = ""
If (MM_formVal = "" Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "" Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'" Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''" & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & " values (" & MM_dbValues & ""
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command"
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "" Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<h1>Scrip Order Form</h1>
<form METHOD="POST" action="<%=MM_editAction%>" name="add_form" id="add_form">
<table width="555" border="1" cellspacing="2" cellpadding="2">
<tr>
<td colspan="4"> </td>
</tr>
<tr>
<td colspan="2">First Name:
<input name="First_Name" type="text" id="First_Name" size="25"></td>
<td width="150">Last name:
<input name="Last_Name" type="text" id="Last_Name" size="25"></td>
<td width="168">Family:
<input name="Family" type="text" id="Family" size="25"></td>
</tr>
<tr>
<td colspan="2">Phone:
<input name="Phone_Number" type="text" id="Phone_Number" size="12"></td>
<td colspan="2">Email
<input name="Email" type="text" id="Email" size="30"></td>
</tr>
<tr>
<td width="78">Check
<input type="radio" name="Check" value="yes"></td>
<td width="123">Credit Card
<input type="radio" name="Credit_card" value="yes"></td>
<td>No.
<input name="Card_No" type="text" id="Card_No" size="20" maxlength="16"></td>
<td>Exp.
<input name="Card_Expire" type="text" id="Card_Expire" size="10"></td>
</tr>
</table>
<p> </p>
<table width="601" border="1" cellspacing="2" cellpadding="2">
<tr>
<td width="208">SCrip</td>
<td width="58"><div align="center">Perc</div></td>
<td width="86">Quantity</td>
<td width="213">Total</td>
</tr>
<tr>
<td>American Eagle $25</td>
<td><div align="center">8</div></td>
<td><input name="American_Eagle_25" type="text" id="American_Eagle_25" value="0" size="10">
</td>
<td>$ </td>
</tr>
<tr>
<td>American Airlines $50</td>
<td><div align="center">12</div></td>
<td> <input name="American_Airlines_50" type="text" id="American_Airlines_50" size="10">
</td>
<td> </td>
</tr>
<tr>
<td>Applebee's $10</td>
<td><div align="center">8</div></td>
<td> <input name="Applebees_10" type="text" id="Applebees_10" size="10"></td>
<td> </td>
</tr>
<tr>
<td>Arby's $5</td>
<td><div align="center">10</div></td>
<td> <input name="Arbys_5" type="text" id="Arbys_5" size="10"></td>
<td> </td>
</tr>
<tr>
<td>AT&T 60 min. card $10</td>
<td><div align="center">20</div></td>
<td> <input name="ATT_60_min_10" type="text" id="ATT_60_min_10" size="10"></td>
<td> </td>
</tr>
<tr>
<td>AT&T 120 min. card $15</td>
<td><div align="center">20</div></td>
<td> <input name="ATT_120_min_15" type="text" id="ATT_120_min_15" size="10"></td>
<td> </td>
</tr>
<tr>
<td>Banana Republic $25</td>
<td><div align="center">9</div></td>
<td> <input name="Banana_Republic_25" type="text" id="Banana_Republic_25" size="10"></td>
<td> </td>
</tr>
<tr>
<td>Barnes & Noble/BDalton $10</td>
<td><div align="center">9</div></td>
<td><input name="Barnes_Nobel_BDalton_10" type="text" id="Barnes_Nobel_BDalton_10" size="10"></td>
<td> </td>
</tr>
<tr>
<td>Baskin Robins $2</td>
<td><div align="center">9 </div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Bath & Body Works $10</td>
<td><div align="center">13</div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Bath & Body Works $25</td>
<td><div align="center">13</div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Bed Bath & Beyond $25</td>
<td><div align="center">6</div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Best Buy $25</td>
<td><div align="center">2</div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Best Buy $100</td>
<td><div align="center">2</div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Blockbuster $10</td>
<td><div align="center">7</div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Bob Evans $5</td>
<td><div align="center">10</div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Borders/Walden Books $10</td>
<td><div align="center">8</div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Brugger's $519</td>
<td><div align="center">19.3</div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Bucca di Beppo $25</td>
<td><div align="center">8</div></td>
<td> </td>
<td> </td>
</tr>
</tr>
<tr>
<td colspan="4"> </td>
</tr>
</table>
<p> </p>
<input type="hidden" name="MM_insert" value="add_form">
</form>
<p> </p>
</body>
</html>
thanks for any help,
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/Sxrip.asp" -->
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abo
rtEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME")
If (Request.QueryString <> "" Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert") = "add_form" Then
MM_editConnection = MM_Sxrip_STRING
MM_editTable = "scriporder"
MM_editRedirectUrl = ""
MM_fieldsStr = "First_Name|value|Last_Name|value|Family|value| Phone_Number|value|Email|value|Check|value|Credit_card| value|Card_No|value|Card_Expire|value|American_Eagle_25| value|American_Airlines_50|value|Applebees_10|value|Arbys_5| value|ATT_60_min_10|value|ATT_120_min_15|value| Banana_Republic_25|value|Barnes_Nobel_BDalton_10|value"
MM_columnsStr = "First_name|',none,''|Last_Name|',none,''|Family|', none,''|Phone_Number|none,none,NULL|Email|',none, ''|Check|',none,''|credit_card|',none,''|Card_No|none,none, NULL|Card_Expire|',none,''|American_Eagle_25|none, none,NULL|American_Airlines_50|none,none, NULL|Applebees_10|none,none,NULL|Arbys_5|none, none,NULL|ATT_60_min_10|none,none, NULL|ATT_120_min_15|none,none,NULL|Banana_Republic_25|none, none,NULL|Barnes_Nobel_BDalton_10|none, none,NULL"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|"
MM_columns = Split(MM_columnsStr, "|"
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "" Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "" Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
Dim MM_tableValues
Dim MM_dbValues
If (CStr(Request("MM_insert") <> "" Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),","
MM_delim = MM_typeArray(0)
If (MM_delim = "none" Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none" Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none" Then MM_emptyVal = ""
If (MM_formVal = "" Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "" Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'" Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''" & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & " values (" & MM_dbValues & ""
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command"
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "" Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<h1>Scrip Order Form</h1>
<form METHOD="POST" action="<%=MM_editAction%>" name="add_form" id="add_form">
<table width="555" border="1" cellspacing="2" cellpadding="2">
<tr>
<td colspan="4"> </td>
</tr>
<tr>
<td colspan="2">First Name:
<input name="First_Name" type="text" id="First_Name" size="25"></td>
<td width="150">Last name:
<input name="Last_Name" type="text" id="Last_Name" size="25"></td>
<td width="168">Family:
<input name="Family" type="text" id="Family" size="25"></td>
</tr>
<tr>
<td colspan="2">Phone:
<input name="Phone_Number" type="text" id="Phone_Number" size="12"></td>
<td colspan="2">Email
<input name="Email" type="text" id="Email" size="30"></td>
</tr>
<tr>
<td width="78">Check
<input type="radio" name="Check" value="yes"></td>
<td width="123">Credit Card
<input type="radio" name="Credit_card" value="yes"></td>
<td>No.
<input name="Card_No" type="text" id="Card_No" size="20" maxlength="16"></td>
<td>Exp.
<input name="Card_Expire" type="text" id="Card_Expire" size="10"></td>
</tr>
</table>
<p> </p>
<table width="601" border="1" cellspacing="2" cellpadding="2">
<tr>
<td width="208">SCrip</td>
<td width="58"><div align="center">Perc</div></td>
<td width="86">Quantity</td>
<td width="213">Total</td>
</tr>
<tr>
<td>American Eagle $25</td>
<td><div align="center">8</div></td>
<td><input name="American_Eagle_25" type="text" id="American_Eagle_25" value="0" size="10">
</td>
<td>$ </td>
</tr>
<tr>
<td>American Airlines $50</td>
<td><div align="center">12</div></td>
<td> <input name="American_Airlines_50" type="text" id="American_Airlines_50" size="10">
</td>
<td> </td>
</tr>
<tr>
<td>Applebee's $10</td>
<td><div align="center">8</div></td>
<td> <input name="Applebees_10" type="text" id="Applebees_10" size="10"></td>
<td> </td>
</tr>
<tr>
<td>Arby's $5</td>
<td><div align="center">10</div></td>
<td> <input name="Arbys_5" type="text" id="Arbys_5" size="10"></td>
<td> </td>
</tr>
<tr>
<td>AT&T 60 min. card $10</td>
<td><div align="center">20</div></td>
<td> <input name="ATT_60_min_10" type="text" id="ATT_60_min_10" size="10"></td>
<td> </td>
</tr>
<tr>
<td>AT&T 120 min. card $15</td>
<td><div align="center">20</div></td>
<td> <input name="ATT_120_min_15" type="text" id="ATT_120_min_15" size="10"></td>
<td> </td>
</tr>
<tr>
<td>Banana Republic $25</td>
<td><div align="center">9</div></td>
<td> <input name="Banana_Republic_25" type="text" id="Banana_Republic_25" size="10"></td>
<td> </td>
</tr>
<tr>
<td>Barnes & Noble/BDalton $10</td>
<td><div align="center">9</div></td>
<td><input name="Barnes_Nobel_BDalton_10" type="text" id="Barnes_Nobel_BDalton_10" size="10"></td>
<td> </td>
</tr>
<tr>
<td>Baskin Robins $2</td>
<td><div align="center">9 </div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Bath & Body Works $10</td>
<td><div align="center">13</div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Bath & Body Works $25</td>
<td><div align="center">13</div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Bed Bath & Beyond $25</td>
<td><div align="center">6</div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Best Buy $25</td>
<td><div align="center">2</div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Best Buy $100</td>
<td><div align="center">2</div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Blockbuster $10</td>
<td><div align="center">7</div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Bob Evans $5</td>
<td><div align="center">10</div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Borders/Walden Books $10</td>
<td><div align="center">8</div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Brugger's $519</td>
<td><div align="center">19.3</div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Bucca di Beppo $25</td>
<td><div align="center">8</div></td>
<td> </td>
<td> </td>
</tr>
</tr>
<tr>
<td colspan="4"> </td>
</tr>
</table>
<p> </p>
<input type="hidden" name="MM_insert" value="add_form">
</form>
<p> </p>
</body>
</html>