Database content not displaying when paging in ASP - asp-classic

I've been working on a site using Classis ASP for a while (on my own personal server) however I've hit a stumbling block. I'm trying to get paging to work but for some reason nothing shows up on the pages, I cannot fathom it at all.
Basically the site is an advertisement board, on one page it shows the total of each item type, click on that and it shows those items but pages them.
<%
If (Request.QueryString("type") <> "" ) Then
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "select s.Unique_ID, s.Location,s.Extension,s.Item,s.Description,s.Price,s.Date_On_Sale,s.Type, s.Name, s.Date_Posted " & _
" from tblSales s where Lower(s.Type) = Lower('" & Request.QueryString("type") & "')" , objconn, 3, 3
If (rs.BOF or rs.EOF) Then StrMsg = "<font color='red'> <b> System found no results for <u> " & Request.QueryString("type") & " </u> </b></font>"
End If
%>
<%response.Write(strQuery) %>
<div id="midrow" style="clear:both;">
<div class="center">
<p>To view the details of an item, simply click on desired item</p>
</div>
</div>
<div class="board_bottomrow">
<div class="center">
<% If StrMsg <> "" Then
Response.Write(StrMsg)
Else
Dim bShowPages
rs.PageSize = 20
nPageCount = rs.PageCount
If nPageCount <2 Then
bShowPages = false
Else bShowPages = true
End If
nPage = CLng(Request.QueryString("Page"))
If (Request.QueryString("Page") = "") Then nPage = 1
If nPage < 1 Or nPage > nPageCount Then
nPage = 1
End If
item_type = Request.QueryString("type")
rs.AbsolutePage = nPage
%>
<div> <b> <%= Request.QueryString("type") %> Items </b> </div>
<br>
<table class="table_border" cellpadding="5" cellspacing="5" border="0" style="width:950px" id="items" >
<thead>
<th style="text-align:left"> <b> <font size="2"> Item </font> </b> </th>
<th style="text-align:left"> <b> <font size="2"> Description </font> </b> </th>
<th style="text-align:left;"> <b> <font size="2"> Price </font> </b> </th>
<th style="text-align:left;"> <b> <font size="2"> Posted By </font> </b> </th>
<th style="text-align:left;"> <b> <font size="2"> Extension </font> </b> </th>
<th style="text-align:left;"> <b> <font size="2"> Posted On </font> </b> </th>
</thead>
<tbody>
<%
Response.Write(rs.AbsolutePage)
While Not (rs.Eof Or rs.AbsolutePage <> nPage) %>
<tr style="vertical-align:top">
<td> <a href='Board_Item.asp?link_id=<%=rs("Unique_ID")%>'> <%= rs("Item") %> </a> </td>
<td style="width:350px"> <%= rs("Description") %> </td>
<td style="margin-left:10px"> £ <%= rs("Price") %> </td>
<td> <%= rs("Name") %> </td>
<td> <%= rs("Extension") %> </td>
<td> <%= rs("Date_Posted") %> </td>
</tr>
<%
rs.MoveNext()
Wend
'Response.Write ("bShowPages " & bShowPages)
%>
<!-- show pages only if pageCount > 1 -->
<%If bShowPages <> false Then%>
<tr style="background-color:#f1f1f1">
<td> Pages: </td> <td colspan="5">
<a href='Items.asp?type=<%=item_type%>&Page=1'> First </a>
<a href='Items.asp?type=<%=item_type%>&Page=<%=nPage - 1%>'> Prev </a>
<a href='Items.asp?type=<%=item_type%>&Page=<%=nPage + 1%>'> Next </a>
<a href='Items.asp?type=<%=item_type%>&Page=<%=nPageCount%>'> Last </a>
<td> </td>
</tr>
</tbody>
</table>
<%End If%>
<% End If %>
</div>
<br>
Im pretty aware there is some bad coding in the sample, but it's a personal learning project for me at the moment, if anyone can see why this records wouldn't be displaying id be greatful. The pagenumbers all show up, just non of the records. Thanks.

Related

print signs on two columns table in Classic ASP

I am trying to print signs in two columns table in classic ASP, ASP file receive the Item-ID's and put them in Array then loop to select signs content from the database, i been able to print in one column, when i tried this code to print in two column i got nothing.
i am not sure what is wrong with the two For statement to loop on records, please help.
<%# LANGUAGE="VBSCRIPT" CodePage = 65001%>
<%
Session.CodePage = 65001
Response.charset ="utf-8"
Session.LCID = 1033 'en-US
%>
<% Response.CharSet = "UTF-8" %>
<%Dim d1
Dim MyArray
Dim myVal
Dim dept
Dim stype
Dim stemp
d1=request("d1")
dept=request("dept")
stype=request("stype")
stemp=request("stemp")
%>
<%
MyArray=Split(d1,",")
For i=0 to UBound(MyArray)
myVal=Trim(MyArray(i))
Dim objConn
set objConn = server.CreateObject("ADODB.Connection")
objConn.Connectionstring="DRIVER={Microsoft Access Driver (*.mdb)};" &_
"DBQ="&server.mappath("\db\Signs - Zone Pricing.mdb")
objConn.Open
Dim strsql
strsql = "SELECT * From " & dept & " where plu='"&myVal&"'"
Dim objRS
Dim BarcodeData
BarcodeData = mid(myval,2,11)
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strsql, objConn
%>
<html>
<head>
<title>New Page</title>
</head>
<body>
<table cellspacing="0" cellpadding="0" bordercolor="#000000" style="width: 300; height: 125;" class="auto-style1" align="center">
<tr><td>
<%do while not objRS.eof%>
<table border="0" cellspacing="0" width="300" bordercolor="#C0C0C0" id="table1" height="125" background="../images/ServiceSign-Self_3x1.25-1.jpg">
<tr>
<td align="right" style="width: 285PX; height: 20px;" colspan="2"></td>
<%If request("dept") = "Grocery" then %><%IF objRS("UNFI") = "UNFI" then %>
<td align="right" style="width: 15PX; height: 20px;" class="auto-style2">
</td><%Else%>
<td align="right" style="width: 15px; height: 20px;"></td><%End If%><%Else%>
<td align="right" style="width: 15px; height: 20px;"></td><%End If%>
</tr>
<tr>
<td align="right" style="height: 10px; width: 300px;" colspan="4" class="auto-style3"><font face="Neutraface 2 Text Bold" style="font-size: 8pt"><%If request("dept") = "Grocery" then%>
<%=objRS("MISC DESCR")%><%else %><%end if%></font></td>
</tr>
<tr>
<td style="height: 5px; width: 300px;" colspan="3"></td>
</tr>
<tr class="auto-style4">
<td style="height: 20x;" colspan="3">
<p align="center" style="width: 300px; height: 20px"><font face="Neutraface 2 Text Bold" style="font-size: 12pt"><%If request("dept") = "Grocery" then%>
<%=objRS("Description")%><%else%><%=objRS("item")%><br><%=objRS("NAME2")%><%end if%></font>
</td>
</tr>
<tr>
<td style="width: 175px; height:20">
<img src="<%="http://example.com/IDAutomation/IDAutomationStreamingLinear.aspx?D=" & BarcodeData%>&BH=0.5&H=1.5&S=6&CC=T&FS=8&LM=0.0&TM=0.0&BM=0.0"/>
</td>
<td style="width: 75px; height:20; vertical-align:middle" colspan="2" align="right" >
<font face="Neutraface 2 Text Bold" style="font-size: 16pt"><p align="right">
<p align="right"><%=Int(objRS("price"))%>.<%=Right(objRS("price")*100,2)%></font><font face="Neutraface 2 Text Demi" style="font-size: 8pt"> <%=objRS("unit")%></font> </td>
</tr>
<tr><td style="width: 300px; height:10" colspan="5" align="right" ></td></tr>
</table>
<%objRS.movenext%>
<%loop%>
</td>
</tr>
<%Next%>
</table>
<br>
<p> </p>
<p align="center"><font face="Arial" size="2">
<a style="color: #530000" href="signs.asp">Back</a></font></p>
</body>
</html>
The Results looks like this
Two Column Result I am looking for
Many assumptions made here, also I think my logic is out in the mod section BUT it does display a two column html table... a little hacky there.
The original code was all over the place, so I reorganised it a bit.
Hopefully this will be enough to get the idea two column HTML table
<%# LANGUAGE="VBSCRIPT" codepage="65001"%>
<%
SESSION.CODEPAGE = 65001
Response.charset ="utf-8"
Session.LCID = 1033 'en-US
RESPONSE.CHARSET = "UTF-8" %>
<HTML>
<HEAD>
<TITLE>New Page</TITLE>
</HEAD>
<BODY>
<%
DIM D1
DIM MYARRAY
DIM MYVAL
DIM DEPT
DIM STYPE
DIM STEMP
D1=request("d1")
dept=request("dept")
sType=request("sType")
sTemp=request("sTemp")
d1="123456789000,123456789001"
dept="grocery"
sType=request("sType")
sTemp=request("sTemp")
DIM OBJCONN : SET OBJCONN = server.CreateObject("ADODB.Connection")
dim strConnectionString : strConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&server.mappath("\db\SignsZonePricing.mdb;")
objConn.Connectionstring = strConnectionString
objConn.Open
Dim strsql
Dim objRS
MyArray=Split(d1,",")
dim varUnfi : varUnfi = ""
dim varMiscError : varMiscError = ""
dim varDescription : varDescription= ""
Dim varItem : varItem = ""
dim varName2 : varName2 = ""
dim varPrice : varPrice = ""
dim varUnit : varUnit = ""
dim intRecordcount : intRecordcount = ""
dim tablecount : tablecount = 1
dim intcolumncount : intcolumncount = 1
%>
<TABLE border="0" cellspacing="0" cellpadding="0" align="center" >
<TR>
<td valign='top'>
<table border="1" cellspacing="0" cellpadding="0" bordercolor="#000000" id="table1">
<tr>
<td valign='top'>
<%
FOR I=0 to UBound(MyArray)
myVal = Trim(MyArray(i))
BarcodeData = mid(myval,2,11)
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.CursorLocation = 3
strSql = "SELECT * From " & dept & " where plu='"&myVal&"'"
objRS.Open strsql, objConn
intRecordcount = objRS.Recordcount
If not objRS.EOF Then
Do Until objRS.EOF
varUnfi = OBJRS("UNFI")
varMiscDescription = objRs("miscDescription")
varDescription = objRS("Description")
vatItem = objRS("item")
varName2 = objRS("NAME2")
varPrice = objRS("price")
varUnit = objRS("unit")
%>
<TABLE width="300" height="125" border="0" cellspacing="0" cellpadding="0" bordercolor="#000000" id="table1">
<TR>
<TD align="right" colspan="2">
</TD>
<%IF UCASE(DEPT) = ucase("Grocery") then %><%IF UCASE(VARUNFI) = "UNFI" then %>
<TD align="right"><%= ucase(varUnfi)%>
</TD>
<%ELSE%>
<td align="right"></td>
<%End If%>
<%ELSE%>
<td align="right"> </td>
<%End If%>
</TR>
<TR>
<TD align="right" colspan="3"><FONT fac e="Arial" style="font-size: 8pt"><%IF UCASE(DEPT) = ucase("Grocery") then response.write varMiscDescription%></FONT>
</TD>
</TR>
<TR>
<TD style="height: 5px; width: 300px;" colspan="3">
</TD>
</TR>
<TR>
<TD style="height: 20x;" colspan="3">
<FONT face="Arial" style="font-size: 12pt">
<%IF UCASE(DEPT) = ucase("Grocery") then
Response.Write varDescription & vbCrLf
ELSE
Response.Write varItem & "<br>" & varName2
END IF%>
</font>
</td>
</tr>
<tr>
<td>
<img src="<%="https://www.bcgen.com/demo/linear-dbgs.aspx?D=" &BarcodeData%>&BH=0.5&H=1.5&S=6&CC=T&FS=8&LM=0.0&TM=0.0&BM=0.0"/>
</TD>
<TD colspan="2" align="right"><%=Int(varPrice)%>.<%=right((varPrice*100),2)%></FONT><FONT face="Arial" style="font-size: 8pt"> <%=unit%></FONT>
</TD>
</TR>
<TR>
<TD style="width: 300px; height:10" colspan="5" align="right">
</TD>
</TR>
</TABLE>
<%
IF (TABLECOUNT MOD (INTRECORDCOUNT/2)) = 0 then
if INTRECORDCOUNT = tablecount then
response.write "</td></tr>"
exit for
end if
response.write "</TD></tr></table></td><td valign='top'><TABLE border=""1"" cellspacing=""0"" bordercolor=""#000000"" cellpadding=""0"" title=""table"&tablecount&"""><tr><td>" & vbcrlf & vbcrlf
else
response.write "</TD></tr>" & vbcrlf & vbcrlf
response.write vbtab & vbtab & "<tr><td valign='top'>" & vbcrlf & vbcrlf
end if
tablecount = tablecount + 1
objRS.MoveNext
loop
end if
NEXT
objRS.Close
Set objRS = Nothing
%>
</TABLE>
</td>
</tr>
</TABLE>
<P> </P>
<P align="center"><FONT face="Arial" size="2">
<A style="color: #530000" href="signs.asp">Back</A></FONT></P>
</body>
</html>
</BODY>
</HTML>

Web Scrapy - How to loop through title hyperlink that is in <form> or <table summary> Tab

I have a questions about how to loop through a html tab 'form' or 'Table Summary'.
The site : Visit https://mobile.uwants.com/forumdisplay.php?fid=631
I have tried below code but no luck
start_urls = ['https://mobile.uwants.com/forumdisplay.php?fid=631'])
def parse(self, response):
resp =response.xpath("//*[//*[#id='mainbody']/tbody/tr/td/div/table[2]/tbody/tr/td[1]/div[2]/form")
for r in resp:
r = response.xpath('//*[contains(#id,"thread_197")]/a/#href').extract_first()
yield response.follow(r,self.parse_items)
The first image is that this is my initial table that i would like the problem to loop through each comments
The second image is that this is one of the sample that i would like to scrap the comment
HTML Code
<form method="post" name="moderate" action="topicadmin.php?action=moderate&fid=631">
<input type="hidden" name="formhash" value="df27712a" />
<table summary="forum_631" cellspacing="0" cellpadding="0">
<thead class="category">
<tr>
<td class="folder"> </td>
<td class="icon"> </td>
<th>標題</th>
<td class="author">作者</td>
<td class="nums">回覆/查看</td>
<td class="lastpost">最後發表</td>
</tr>
</thead>
<tbody>
<tr>
<td class="folder"><img src="https://n2.hk/images/default/folder_common.gif" alt="announcement" /></td>
<td class="icon"> </td>
<th class="tsubject">論壇公告: 開戰準備!全新版區《Gundam Fan Club》開放!</th>
<td class="author">
<cite>mhmimi</cite>
<em>2017-6-9</em>
</td>
<td class="nums">-</td>
<td class="lastpost">-</td>
</tr>
</tbody>
<!-- Text T4 - Modified by Ivan - start-->
<tbody>
<tr>
<td colspan="6" height="35"><!-- Ad space:Uwants_Web_630_T4 --><script src="https://lv.l.networld.hk/lview?loc=_adb_20_10002834&callback=crystal2.addStaticSlot"></script>
</td>
</tr>
</tbody>
<!-- Text T4 - Modified by Ivan - end-->
<tbody id="stickthread_19434311" class="forumdisplay_thread" data-tid="19434311">
<tr>
<td class="folder"><img src="https://n2.hk/images/default/folder_lock.gif" /></td>
<td class="icon">
</td>
<th class="lock">
<label>
<img src="https://n2.hk/images/default/pin_2.gif" alt="分類置頂" />
<!-- By Rex Heat Thread -->
<!-- By Rex Heat Thread -->
</label>
<span id="thread_19434311" class="tsubject"><!-- google_ad_section_start -->請各會員注意,本版新措施(已生效)<!-- google_ad_section_end --></span>
</th>
<td class="author">
<cite>
Yue33695874
</cite>
<em></em>
</td>
<td class="nums">
<strong>0</strong> / <em>41262</em>
</td>
<td class="lastpost">
<em></em>
<cite>by Yue33695874 </cite>
</td>
</tr>
</tbody> <tbody id="stickthread_16031523" class="forumdisplay_thread" data-tid="16031523">
<tr>
<td class="folder"><img src="https://n2.hk/images/default/folder_lock.gif" /></td>
<td class="icon">
</td>
<th class="lock">
<label>
<img src="https://n2.hk/images/default/pin_2.gif" alt="分類置頂" />
<!-- By Rex Heat Thread -->
<!-- By Rex Heat Thread -->
</label>
<span id="thread_16031523" class="tsubject"><!-- google_ad_section_start -->==手機網絡 版版規== 本版嚴禁一切問價及報價, 違者發帖將被移走及不作通知!<!-- google_ad_section_end --></span>
</th>
<td class="author">
<cite>
quimboy1
</cite>
<em></em>
</td>
<td class="nums">
<strong>0</strong> / <em>61033</em>
</td>
<td class="lastpost">
<em></em>
<cite>by quimboy1 </cite>
</td>
</tr>
</tbody> <tbody id="stickthread_16776292" class="forumdisplay_thread" data-tid="16776292">
<tr>
<td class="folder"><img src="https://n2.hk/images/default/folder_lock.gif" /></td>
<td class="icon">
</td>
<th class="lock">
<label>
<img src="https://n2.hk/images/default/pin_1.gif" alt="本版置頂" />
<!-- By Rex Heat Thread -->
<!-- By Rex Heat Thread -->
</label>
<span id="thread_16776292" class="tsubject"><!-- google_ad_section_start -->溫馨提示 : 小心網上流動手提電話公司sales, 已經有騙案個案及已轉交警方處理<!-- google_ad_section_end --></span>
</th>
<td class="author">
<cite>
chungsm
</cite>
<em></em>
</td>
<td class="nums">
<strong>2</strong> / <em>65809</em>
</td>
<td class="lastpost">
<em></em>
<cite>by chungsm </cite>
</td>
</tr>
</tbody><!--
</table>
<table summary="forum_631" id="forum_631" cellspacing="0" cellpadding="0">
-->
手機網絡 - 熱門話題
</td></tr></tbody-->
<!--td class="folder" colspan="2"> </td-->
<td class="folder" ><img src="https://n2.hk/images/r09/hot_u.gif" /></td>
<td class="icon"> </td>
<th class="" >
<label>
<!-- By Rex Heat Thread -->
<!-- By Rex Heat Thread -->
</label>
<span id="thread_ht_1_19782731" class="tsubject">問 : 中國移動4.5G 網絡 地鐵接收如何</span>
New
Thanks for help guys
Try to change this line:
r = response.xpath('//*[contains(#id,"thread_197")]/a/#href').extract_first()
With this:
r = r.xpath('//*[contains(#id,"thread_197")]/a/#href').extract_first()
I think this is what you meant to do!
If you want to fetch all href contained in the table, you can do:
response.css('.tsubject a::attr(href)').extract()

i want to write a hyperlink between table row and table data in out,println statement (servlet) but i cant

out.print(" "++""+rs3.getInt(1)+""+rs3.getString(2)+""+rs3.getString(3)+""+rs3.getString(4)+""+rs3.getString(5)+" "+rs3.getString(6)+""+rs3.getString(7)+""+rs3.getString(8)+"");
I assume you are trying to achieve something like this in servlet....
<html>
<body>
<table border='1'>
<tr>
<td> <a href="link/to/another/page" >LinkToAnotherPage</a> </td>
<td> <a href="link/to/another/page" >LinkToAnotherPage</a> </td>
<td> <a href="link/to/another/page" >LinkToAnotherPage</a> </td>
</tr>
</table>
</body>
</html>
then,in servlet,its quivalent will be...
String myPath="link/to/another/page";
out.print("<table border='1'> <br>" );
out.print("<tr> <br>");
out.print("<td> <a href='"+myPath+"'>LinkToAnotherPage </a> </td>");
out.print("<td> <a href='"+myPath+"'>LinkToAnotherPage </a> </td>");
out.print("</tr> </table> </body> </html>");
Notice ' and " after href=.

If statement error in aspx page

I am doing a product page and I want "You maybe need also these products".
For example if productID is 2 then show me link to productID 5.
I have tried to do it with this:
<% if(Item.ProductID == 2) { %>
<a href="ProductDetails.aspx?productID=5">
<img src="/Catalog/Images/suihkukaappi.png"
width="100" height="75" style="border: solid" /></a>
<% } %>
But it gives me the error "The name 'Item' does not exist in current context." And link works fine if I take this if statement off but the same link is every product page.
Here is my code inside ItemTemplate from aspx page:
<ItemTemplate>
<div>
<h1><%#:Item.ProductName %></h1>
</div>
<br />
<table>
<tr>
<td>
<img src="/Catalog/Images<%#:Item.ImagePath %>" style="border:solid; height:150px; width:175px;" alt="<%#:Item.ProductName %>"/>
</td>
<td> </td>
<td style="vertical-align: top; text-align:left;">
<b>Tuoteselostus:</b><br /><%#:Item.Description %>
<br />
<span><b>Hinta:</b> <%#: String.Format("{0:c}", Item.UnitPrice) %></span>
<br />
<span><b>Tuotenumero:</b> <%#:Item.ProductID %></span>
<br />
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<% if(Item.ProductID == 2) { %>
<a href="ProductDetails.aspx?productID=5">
<img src="/Catalog/Images/suihkukaappi.png"
width="100" height="75" style="border: solid" />
</a>
<% } %>
</td>
</tr>
</table>
</ItemTemplate>
Try using Container.DataItem and cast it to the corresponding model that you are iterating over:
<% if(((Product)Container.DataItem).ProductID == 2) { %>

How to save only edited data that retrieved from database? i'm confused. I can delete specific record but can not save only specific record

I need to retrieve product info. from database and now want to edit some data and save it back to database. I've created Edit Form page and passed value to the other Save page. What I want is only to save record that had been edited however when i clicked "save" button, data of all records were passed through. What i confused was with the same passing method, I can successfully delete only specific record.
Here's my code..
<table cellpadding="0" cellspacing="0" border="1" width="100%">
<tr class="border bluebackend" >
<td class="center bold" width="30">Size</td>
<td class="center bold" width="30">Color</td>
<td class="center bold" width="27%">Est. Qty (dz.)</td>
<td class="center bold" width="30"> </td>
<td class="center bold" width="30"> </td>
</tr>
<%
dim total_qty_est, total_qty
if rsPdtn_sizeColor.eof then
response.Write "<tr><td colspan=""3"">file not found</td></tr>"
Else
Do while Not rsPdtn_sizeColor.EOF
total_qty_est = rsPdtn_sizeColor.fields.item("pdtn_st_qty_est")
total_qty = total_qty + total_qty_est
%>
<tr >
<td class="center">
<select name="pdtn_st_size">
<option selected>-- size -- </option>
<option value="L" <%=checkSelectedScript(rsPdtn_sizeColor.fields.item("pdtn_st_size"),"L")%>>L</option>
<option value="XL" <%=checkSelectedScript(rsPdtn_sizeColor.fields.item("pdtn_st_size"),"XL")%>>XL</option>
</select>
</td>
<td class="center">
<select name="pdtn_st_color">
<option selected>-- color -- </option>
<option value="Orange" <%=checkSelectedScript(rsPdtn_sizeColor.fields.item("pdtn_st_color"),"Orange")%>>Orange</option>
<option value="Pink" <%=checkSelectedScript(rsPdtn_sizeColor.fields.item("pdtn_st_color"),"Pink")%>>Pink</option> 
</select>
</td>
<td class="center">
<input type="text" value="<%=PcsToDz(rsPdtn_sizeColor.fields.item("pdtn_st_qty_est"))%>" name="pdtn_st_qty_est" size="3">
(<%=rsPdtn_sizeColor.fields.item("pdtn_st_qty_est")%>)
</td>
<td><input type="button" name="" value="Del" onClick="confirmationDeletePrice('../engine/delPdtn_szCl.asp?pdtn_szcl_id= <%=rsPdtn_sizeColor.fields.item("pdtn_szcl_id")%>&pdtn_st_id=<%=rsPdtn_sizeColor.fields.item("tbl_pdtn_sizecolor.pdtn_st_id")%>')"></td>
<td class="center" >
<input type="button" name="" value="Save" onClick="confirmationSaveProduction_Szcl('production_szcl_edit_action.asp?pdtn_szcl_id= <%=rsPdtn_sizeColor.fields.item("pdtn_szcl_id")%>')">
<input type="hidden" value="Y" name="edit_pdtn_szcl">
<input type="hidden" value="<%=rsPdtn_sizeColor.fields.item("pdtn_szcl_id")%>" name="pdtn_szcl_id">
</td>
</tr>
<%
rsPdtn_sizeColor.movenext
Loop
rsPdtn_sizeColor.movefirst
end if
%>
and this is my Save page code...
<%
pdtn_st_id = Request.form("pdtn_st_id")
pdtn_st_qty_est_dz = Request.form("pdtn_st_qty_est")
if pdtn_st_qty_est_dz <> "" then
pdtn_st_qty_est = DztoPcs(pdtn_st_qty_est_dz)
end if
pdtn_st_size = Request.form("pdtn_st_size")
pdtn_st_color = Request.form("pdtn_st_color")
edit_pdtn_szcl = Request.form("edit_pdtn_szcl")
call checkBlank(pdtn_st_qty_est)
if SomethingError <> "yes" then
Call DBConnOpen()
Set Rs = Server.CreateObject("ADODB.Recordset")
Set Rs.ActiveConnection = Conn
strSQL = "SELECT * FROM tbl_pdtn_sizecolor"
pdtn_szcl_id = Request.form("pdtn_szcl_id")
strSQL = strSQL & " WHERE pdtn_szcl_id =" & pdtn_szcl_id & ""
Rs.Open strSQL, Conn, 1, 3
Rs.Fields("pdtn_st_id") = pdtn_st_id
Rs.Fields("pdtn_st_qty_est") = pdtn_st_qty_est
Rs.Fields("pdtn_st_size") = pdtn_st_size
Rs.Fields("pdtn_st_color") = pdtn_st_color
Rs.Update
Rs.Close
response.redirect "production_view.asp?pdtn_st_id=" & pdtn_st_id
Call DBConnClose()
else
call writeInputError
end if
%>
The simplest solution is to move your existing tags to around the table row in the loop. That way you will be able to edit one row at a time without modifying your save page code.
I have added the form tags to your code below, but you would need to use the FORM tag you are already using:
<table cellpadding="0" cellspacing="0" border="1" width="100%">
<tr class="border bluebackend" >
<td class="center bold" width="30">Size</td>
<td class="center bold" width="30">Color</td>
<td class="center bold" width="27%">Est. Qty (dz.)</td>
<td class="center bold" width="30"> </td>
<td class="center bold" width="30"> </td>
</tr>
<%
dim total_qty_est, total_qty
if rsPdtn_sizeColor.eof then
response.Write "<tr><td colspan=""3"">file not found</td></tr>"
Else
Do while Not rsPdtn_sizeColor.EOF
total_qty_est = rsPdtn_sizeColor.fields.item("pdtn_st_qty_est")
total_qty = total_qty + total_qty_est
%>
<form action="" method=""><!--move your form open tag here-->
<tr >
<td class="center">
<select name="pdtn_st_size">
<option selected>-- size -- </option>
<option value="L" <%=checkSelectedScript(rsPdtn_sizeColor.fields.item("pdtn_st_size"),"L")%>>L</option>
<option value="XL" <%=checkSelectedScript(rsPdtn_sizeColor.fields.item("pdtn_st_size"),"XL")%>>XL</option>
</select>
</td>
<td class="center">
<select name="pdtn_st_color">
<option selected>-- color -- </option>
<option value="Orange" <%=checkSelectedScript(rsPdtn_sizeColor.fields.item("pdtn_st_color"),"Orange")%>>Orange</option>
<option value="Pink" <%=checkSelectedScript(rsPdtn_sizeColor.fields.item("pdtn_st_color"),"Pink")%>>Pink</option>
</select>
</td>
<td class="center">
<input type="text" value="<%=PcsToDz(rsPdtn_sizeColor.fields.item("pdtn_st_qty_est"))%>" name="pdtn_st_qty_est" size="3">
(<%=rsPdtn_sizeColor.fields.item("pdtn_st_qty_est")%>)
</td>
<td><input type="button" name="" value="Del" onClick="confirmationDeletePrice('../engine/delPdtn_szCl.asp?pdtn_szcl_id= <%=rsPdtn_sizeColor.fields.item("pdtn_szcl_id")%>&pdtn_st_id=<%=rsPdtn_sizeColor.fields.item("tbl_pdtn_sizecolor.pdtn_st_id")%>')"></td>
<td class="center" >
<input type="button" name="" value="Save" onClick="confirmationSaveProduction_Szcl('production_szcl_edit_action.asp?pdtn_szcl_id= <%=rsPdtn_sizeColor.fields.item("pdtn_szcl_id")%>')">
<input type="hidden" value="Y" name="edit_pdtn_szcl">
<input type="hidden" value="<%=rsPdtn_sizeColor.fields.item("pdtn_szcl_id")%>" name="pdtn_szcl_id">
</td>
</tr>
</form><!--move your form close tag here-->
<%
rsPdtn_sizeColor.movenext
Loop
rsPdtn_sizeColor.movefirst
end if
%>

Resources