I'm writing a cart to send the selected item from a item box to a database. I (with the help of programmers here) read the data from the DB adn populated the item boxes but when I go to addNew them to the database I get nothing. Empty fields. Anyone have any ideas on what I'm doing wrong. Thanks
here's the code:
'create arrays
DIM ProcArray()
DIM ProcPriceArray()
REDIM ProcArray(4)
REDIM ProcPriceArray(4)
DIM printerArray()
DIM printerPriceArray()
REDIM printerArray(4)
REDIM printerPriceArray(4)
DIM discArray()
DIM discPriceArray()
REDIM discArray(4)
REDIM discPriceArray(4)
DIM optArray()
DIM optPriceArray()
REDIM optArray(4)
REDIM optPriceArray(4)
strProc="<SELECT name='proc'>"
strDisc="<SELECT name='disc'>"
strPrinter="<SELECT name='printer'>"
strOpt="<SELECT name='opt'>"
strTbl2="<TABLE bgcolor=#996600 border=1 cellpadding=5 cellspacing=5>"
strTbl="<table bgcolor=#996600 border=0 cellpadding=5 cellspacing=5>"
strTblend="</TABLE>"
strrow="<TR>"
strrowend="</TR>"
strcol="<TD>"
strcolend="</TD>"
DO UNTIL Recordset.EOF
if Recordset("PartCode" = "P" Then
ProcArray(x)=Recordset("PartDesc"
ProcPriceArray(x)=Recordset("Price"
strProc=strProc & "<OPTION>"
strProc=strProc & ProcArray(x) & " "
strProc=strProc & "$" & ProcPriceArray(x)
strProc=strProc & "</OPTION>"
elseif Recordset("PartCode" = "H" Then
discArray(x)=Recordset("PartDesc"
discPriceArray(x)=Recordset("Price"
strDisc=strDisc & "<OPTION>"
strDisc=strDisc & discArray(x) & " "
strDisc=strDisc & "$" & discPriceArray(x)
strDisc=strDisc & "</OPTION>"
elseif Recordset("PartCode" = "R" Then
printerArray(x)=Recordset("PartDesc"
printerPriceArray(x)=Recordset("Price"
strPrinter=strPrinter & "<OPTION>"
strPrinter=strPrinter &printerArray(x) & " "
strPrinter=strPrinter & "$" & printerPriceArray(x)
strPrinter=strPrinter &"</OPTION>"
elseif Recordset("PartCode" = "O" Then
optArray(x)=Recordset("PartDesc"
optPriceArray(x)=Recordset("Price"
strOpt=strOpt & "<OPTION>"
strOpt=strOpt & optArray(x) & " "
strOpt=strOpt & "$" & optPriceArray(x)
strOpt=strOpt & "</OPTION>"
end if
Recordset.MoveNext
Loop
strEndSelect="</SELECT>"
Response.Write(strTbl)
Response.Write(strrow)
Response.Write(strcol)
Response.Write(strProc & strEndSelect)
Response.Write(strcolend)
Response.Write(strcol)
Response.Write(strDisc & strEndSelect)
Response.Write(strcolend)
Response.Write(strrowend)
Response.Write(strrow)
Response.Write(strcol)
Response.Write(strPrinter & strEndSelect)
Response.Write(strcolend)
Response.Write(strcol)
Response.Write(strOpt & strEndSelect)
Response.Write(strcolend)
Response.Write(strrowend)
Response.Write(strTblend)
%>
<%
'close the database and set connection to nothing
connectionToDatabase.Close
Set connectionToDatabase=Nothing
%>
Here's where I do teh adding to the DB
set conn = server.createobject("adodb.connection"
conn.open "DSN=orders"
DIM idNum
idnum=((Application("countusers" & 3) & "18"
Set Recordset=Server.CreateObject("ADODB.Recordset"
Recordset.Open "tblOrder", conn, 1, 2
Recordset.AddNew
Recordset("OrderNum"=(idNum)
Recordset("Processor"=Request.Form("proc"
Recordset("Optical"=Request.Form("opt"
Recordset("RAM"=Request.Form("printer"
Recordset("HardDrive"=Request.Form("disc"
Recordset("TotalCost"=Request.Form("total"
Recordset("Address"=Request.Form("email" provide tools to let people become their best.
here's the code:
'create arrays
DIM ProcArray()
DIM ProcPriceArray()
REDIM ProcArray(4)
REDIM ProcPriceArray(4)
DIM printerArray()
DIM printerPriceArray()
REDIM printerArray(4)
REDIM printerPriceArray(4)
DIM discArray()
DIM discPriceArray()
REDIM discArray(4)
REDIM discPriceArray(4)
DIM optArray()
DIM optPriceArray()
REDIM optArray(4)
REDIM optPriceArray(4)
strProc="<SELECT name='proc'>"
strDisc="<SELECT name='disc'>"
strPrinter="<SELECT name='printer'>"
strOpt="<SELECT name='opt'>"
strTbl2="<TABLE bgcolor=#996600 border=1 cellpadding=5 cellspacing=5>"
strTbl="<table bgcolor=#996600 border=0 cellpadding=5 cellspacing=5>"
strTblend="</TABLE>"
strrow="<TR>"
strrowend="</TR>"
strcol="<TD>"
strcolend="</TD>"
DO UNTIL Recordset.EOF
if Recordset("PartCode" = "P" Then
ProcArray(x)=Recordset("PartDesc"
ProcPriceArray(x)=Recordset("Price"
strProc=strProc & "<OPTION>"
strProc=strProc & ProcArray(x) & " "
strProc=strProc & "$" & ProcPriceArray(x)
strProc=strProc & "</OPTION>"
elseif Recordset("PartCode" = "H" Then
discArray(x)=Recordset("PartDesc"
discPriceArray(x)=Recordset("Price"
strDisc=strDisc & "<OPTION>"
strDisc=strDisc & discArray(x) & " "
strDisc=strDisc & "$" & discPriceArray(x)
strDisc=strDisc & "</OPTION>"
elseif Recordset("PartCode" = "R" Then
printerArray(x)=Recordset("PartDesc"
printerPriceArray(x)=Recordset("Price"
strPrinter=strPrinter & "<OPTION>"
strPrinter=strPrinter &printerArray(x) & " "
strPrinter=strPrinter & "$" & printerPriceArray(x)
strPrinter=strPrinter &"</OPTION>"
elseif Recordset("PartCode" = "O" Then
optArray(x)=Recordset("PartDesc"
optPriceArray(x)=Recordset("Price"
strOpt=strOpt & "<OPTION>"
strOpt=strOpt & optArray(x) & " "
strOpt=strOpt & "$" & optPriceArray(x)
strOpt=strOpt & "</OPTION>"
end if
Recordset.MoveNext
Loop
strEndSelect="</SELECT>"
Response.Write(strTbl)
Response.Write(strrow)
Response.Write(strcol)
Response.Write(strProc & strEndSelect)
Response.Write(strcolend)
Response.Write(strcol)
Response.Write(strDisc & strEndSelect)
Response.Write(strcolend)
Response.Write(strrowend)
Response.Write(strrow)
Response.Write(strcol)
Response.Write(strPrinter & strEndSelect)
Response.Write(strcolend)
Response.Write(strcol)
Response.Write(strOpt & strEndSelect)
Response.Write(strcolend)
Response.Write(strrowend)
Response.Write(strTblend)
%>
<%
'close the database and set connection to nothing
connectionToDatabase.Close
Set connectionToDatabase=Nothing
%>
Here's where I do teh adding to the DB
set conn = server.createobject("adodb.connection"
conn.open "DSN=orders"
DIM idNum
idnum=((Application("countusers" & 3) & "18"
Set Recordset=Server.CreateObject("ADODB.Recordset"
Recordset.Open "tblOrder", conn, 1, 2
Recordset.AddNew
Recordset("OrderNum"=(idNum)
Recordset("Processor"=Request.Form("proc"
Recordset("Optical"=Request.Form("opt"
Recordset("RAM"=Request.Form("printer"
Recordset("HardDrive"=Request.Form("disc"
Recordset("TotalCost"=Request.Form("total"
Recordset("Address"=Request.Form("email" provide tools to let people become their best.