Forums
This topic is locked
Basics - Help
Posted 15 Dec 2003 20:21:48
1
has voted
15 Dec 2003 20:21:48 Michael Rissi posted:
I am relatively new to asp programming.. Here is my problem:I am creating an orderform.asp which needs to update two sql server tables -- the first one is the orderheader table and the other is the orderline table.
also, the form i have created is basically a list which the user will check on the products he wishes to purchase.
Here is the code.
<%@ Language=VBScript %>
<!--#include file="../Connections/formsconn.asp" -->
<%
dim stateid
DIM AGENT
AGENT = Request.FORM("agentcode"
stateid = Request.form("selectedstate"
agentlastname = Request.form("agentlastname"
dim cn1
dim rsITEM
dim rsITEMdetail
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>FMX Order Form</title></HEAD>
<BODY text="#000000" link="#006699" vlink="#006699" alink="#006699" leftmargin="0" topmargin="0">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" vspace="0" hspace="0">
<tr bgcolor="#006699" valign="center">
<td height="20" align="left"> <IMG height=1 src="../images/black.gif" width=200 align=absMiddle><IMG height=25 src="../images/fmsystem.gif" width=250 align=absMiddle></td>
</tr>
<tr bgcolor="#000000">
<td height="12"><IMG height=1 src="../images/white.gif" width=420></td>
</tr>
<tr bgcolor="#cccccc" valign="top" align="left">
<td width="96%" height="387" bgcolor="#ffffff">
<table width="500" border="0" cellpadding="2" cellspacing="0">
<tr>
<td><img src="../images/white.gif" width="10" height="1"></td>
<td><font size="2" face="Tahoma, Arial"><strong><a href="../uim/agent.asp"><font color="#000000">Back</font></a></strong></font><font color="#006600"> </font></td>
</tr>
<tr>
<td> </td>
<td><font face="Tahoma, Arial"><strong><font color="#006699">CUSTOMIZED
ORDER FORM</font></strong></font></td>
</tr>
<tr>
<td> </td>
<td><p><font color="#000000" size="2" face="Arial, Helvetica, sans-serif">Below
are the current available forms for the Agent and State you have
selected. Check the box(s) for the items you wish to order, then
select the quantity from the drop down. When you are finished click
the Submit button at the bottom of this page to process your order.
Click Reset to clear all fields and start over.</font><font color="#000000"><br>
<br>
<strong><font size="2" face="Arial, Helvetica, sans-serif"> You
are ordering forms for Agent:
<%Response.Write("<font color =blue > <b>" + AGENT + "</b> </font>"%>
<br>
Selected S</font></strong></font><strong><font size="2" face="Arial, Helvetica, sans-serif">tate:
<%Response.Write("<font color =blue > <b>" + stateid + "</b> </font>"%>
</font></strong><br>
<br>
<strong><font color="#333333" size="2" face="Arial, Helvetica, sans-serif"><em>Note:</em>
</font></strong><font color="#333333" size="2" face="Arial, Helvetica, sans-serif">
<em>Clicking the Submit button more than once will result in multiple
orders being requested.</em></font></p></td>
</tr>
<tr>
<td> </td>
<td><font color="#000000"><img src="../images/black.gif" width="650" height="1" hspace="2" vspace="4"></font></td>
</tr>
</table>
<p>
<%
set cn1= server.CreateObject("adodb.Connection"
set rsITEM= server.CreateObject("adodb.recordset"
set rsITEMdetail = server.CreateObject ("adodb.recordset"
cn1.Provider="msdatashape"
cn1.Open "dsn=eastcoastgraphics078;uid=sa"
rsITEM.Open "SHAPE {select * from Package} " & _
"append ({select * from ITEM a join lnkitemstate b on a.itemid = b.itemid join PackItemLnk c on a.itemid = c.itemid where " & _
"statecd = '" + stateid + "' } " & _
"relate Package_id to Package_id) as chapITEMdetail", _
cn1
set rsITEMdetail = rsITEM("chapITEMdEtail".Value
%></font>
</p>
<font color="#000000">
<table><form action="orderprocessing.asp" method="get" >
<%do until rsitem.EOF
Response.Write "<table bgcolor=#FFFFFF cellpadding=2 cellspacing=0" %>
width="75%"
<%Response.Write " border=1 bordercolor=#000000> " &_
"<tr align=center><strong><u><font face=arial size=3 color=blue>"%>
<% Response.Write rsitem("Package_Name" &_
"</u></strong></font></tr>" &_
"<tr align=center bgcolor=#999999><td nowrap><font face=arial size=2 color=#000000><strong>Select</strong></font></td>" &_
"<td nowrap><font face=arial size=2 color=#000000><strong>Item Description</strong></font></td>" &_
"<td nowrap><font face=arial size=2 color=#000000><strong>Item Number</strong></font></td>" &_
"<td nowrap><font face=arial size=2 color=#000000><strong>Qty</strong></font></td></font></tr>"
%>
<%
do until rsitemdetail.eof
Response.Write "<tr><td bgcolor=#CCCCCC nowrap"%>
width="5%"
<%Response.Write "align = center><input type =checkbox name = " &_
rsitemdetail("itemnm" & _
"></td>" &_
"<td bgcolor=#FFFFFF nowrap"%>
width = "20%"
<%Response.Write "> <font face=arial size=2 color=#000000>" &_
rsitemdetail("itemdesc" & "</td><td bgcolor=#FFFFFF"%>
width = "20%"
<%Response.Write "> <font face=arial size=2 color=#000000>" &_
rsitemdetail("itemnm" &_
"</td>" &_
"<td bgcolor=#CCCCCC"%>
width = "5%"
<% Response.Write "<select size = 1 name = " &_
rsitemdetail("itemnm" &_
"> <SELECT size =1 id=select1 name=qty>" &_
"<OPTION value = ""0"">0</option>"&_
"<OPTION value = ""5"">5</option>"&_
"<OPTION value = ""10"">10</option>"&_
" <OPTION value = ""15"">15</option>"&_
"<OPTION value = ""20"">20</option>"&_
"<OPTION value = ""25"">25</option>" &_
"<OPTION value = ""30"">30</option>" & _
"</select></td></tr>" %>
<% rsITEMdetail.MoveNext
loop%>
<%rsitem.MoveNext
loop
%>
</table>
<br>
<input type = submit width= "75%" align ="center" id="Submit1" name="Submit1" value="Submit Order">
<input type = reset></FORM>
</font></td>
</table>
</BODY>
</HTML>
My thought would be to pass the variables on to an order processing page, but since no variable exists yet for the orderid,
How do I do this?
Help!
Thanks,
Mike