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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Response.Write("<SELECT>") Trouble 1

Status
Not open for further replies.

onpnt

Programmer
Dec 11, 2001
7,778
US
I have a asp order page that I want four drop downs to go in. I'm reading the items from a DB and that is going good after earlier help, but now I can't seem to get the second thru fourth arrays to populate...only the first. Any sugestions. 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)

'get processor
Response.Write(&quot;<SELECT name='proc'>&quot;)
DO UNTIL Recordset.EOF

if Recordset(&quot;PartCode&quot;) = &quot;P&quot; Then
ProcArray(x)=Recordset(&quot;PartDesc&quot;)
ProcPriceArray(x)=Recordset(&quot;Price&quot;)

Response.Write(&quot;<OPTION>&quot;) 'get processor
Response.Write(ProcArray(x) & &quot; &quot;)
Response.Write(&quot;$&quot; & ProcPriceArray(x))
Response.Write(&quot;</OPTION>&quot;)

end if
Recordset.MoveNext
Loop
Response.Write(&quot;</SELECT>&quot;)

Response.Write(&quot;<SELECT name='disc'>&quot;)
DO UNTIL Recordset.EOF

if Recordset(&quot;PartCode&quot;) = &quot;H&quot; Then 'get hard disc
discArray(x)=Recordset(&quot;PartDesc&quot;)
discPriceArray(x)=Recordset(&quot;Price&quot;)

Response.Write(&quot;<OPTION>&quot;)
Response.Write(discArray(x) & &quot; &quot;)
Response.Write(&quot;$&quot; & discPriceArray(x))
Response.Write(&quot;</OPTION>&quot;)

end if
Recordset.MoveNext
Loop
Response.Write(&quot;</SELECT>&quot;)
Response.Write(&quot;<SELECT name='printer'>&quot;)

DO UNTIL Recordset.EOF

if Recordset(&quot;PartCode&quot;) = &quot;R&quot; Then 'get printers
printerArray(x)=Recordset(&quot;PartDesc&quot;)
printerPriceArray(x)=Recordset(&quot;Price&quot;)

Response.Write(&quot;<OPTION>&quot;)
Response.Write(printerArray(x) & &quot; &quot;)
Response.Write(&quot;$&quot; & printerPriceArray(x))
Response.Write(&quot;</OPTION>&quot;)

end if
Recordset.MoveNext
Loop
Response.Write(&quot;</SELECT>&quot;)
Response.Write(&quot;<SELECT name='opt'>&quot;)

DO UNTIL Recordset.EOF
if Recordset(&quot;PartCode&quot;) = &quot;O&quot; Then 'get last but not least the optical
optArray(x)=Recordset(&quot;PartDesc&quot;)
optPriceArray(x)=Recordset(&quot;Price&quot;)

Response.Write(&quot;<OPTION>&quot;)
Response.Write(optArray(x) & &quot; &quot;)
Response.Write(&quot;$&quot; & optPriceArray(x))
Response.Write(&quot;</OPTION>&quot;)

end if
Recordset.MoveNext
Loop
Response.Write(&quot;</SELECT>&quot;)
%> provide tools to let people become their best.
 
Since all of your data is in the same recordset, after you populate the first select the recordset is at the EOF. Hence none of the other select boxes will be populated.
Try the following


<!-- 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)

'get processor
strProc=&quot;<SELECT name='proc'>&quot;
strDisc=&quot;<SELECT name='disc'>&quot;
strPrinter=&quot;<SELECT name='printer'>&quot;
strOpt=&quot;<SELECT name='opt'>&quot;

DO UNTIL Recordset.EOF

if Recordset(&quot;PartCode&quot;) = &quot;P&quot; Then
ProcArray(x)=Recordset(&quot;PartDesc&quot;)
ProcPriceArray(x)=Recordset(&quot;Price&quot;)

strProc=strProc & &quot;<OPTION>&quot; 'get processor
strProc=strProc & ProcArray(x) & &quot; &quot;
strProc=strProc & &quot;$&quot; & ProcPriceArray(x)
strProc=strProc & &quot;</OPTION>&quot;

elseif Recordset(&quot;PartCode&quot;) = &quot;H&quot; Then 'get hard disc
discArray(x)=Recordset(&quot;PartDesc&quot;)
discPriceArray(x)=Recordset(&quot;Price&quot;)

strDisc=strDisc & &quot;<OPTION>&quot;
strDisc=strDisc & discArray(x) & &quot; &quot;
strDisc=strDisc & &quot;$&quot; & discPriceArray(x)
strDisc=strDisc & &quot;</OPTION>&quot;

elseif Recordset(&quot;PartCode&quot;) = &quot;R&quot; Then 'get printers
printerArray(x)=Recordset(&quot;PartDesc&quot;)
printerPriceArray(x)=Recordset(&quot;Price&quot;)

strPrinter=strPrinter & &quot;<OPTION>&quot;
strPrinter=strPrinter &printerArray(x) & &quot; &quot;
strPrinter=strPrinter & &quot;$&quot; & printerPriceArray(x)
strPrinter=strPrinter &&quot;</OPTION>&quot;

elseif Recordset(&quot;PartCode&quot;) = &quot;O&quot; Then 'get last but not least the optical
optArray(x)=Recordset(&quot;PartDesc&quot;)
optPriceArray(x)=Recordset(&quot;Price&quot;)

strOpt=strOpt & &quot;<OPTION>&quot;
strOpt=strOpt & optArray(x) & &quot; &quot;
strOpt=strOpt & &quot;$&quot; & optPriceArray(x)
strOpt=strOpt & &quot;</OPTION>&quot;

end if

Recordset.MoveNext
Loop

strEndSelect=&quot;</SELECT>&quot;
Response.Write(strProc & strEndSelect)

Response.Write(strDisc & strEndSelect)


Response.Write(strPrinter & strEndSelect)

Response.Write(strOpt & strEndSelect)
%>
 
You should start sending me a bill SarkMan. I thank you again.

deBugged once again. provide tools to let people become their best.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top