Print Page | Close Window

Form/Database Update only applying to first record

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
Printed Date: 18 January 2021 at 6:36am
Software Version: Web Wiz Forums 12.03 -

Topic: Form/Database Update only applying to first record
Posted By: lee2121
Subject: Form/Database Update only applying to first record
Date Posted: 22 May 2019 at 4:37pm
I'm in the middle of developing a classic asp website and we have a cart function which displays whats currently in the users cart, this workd well it displays however many products they have in there cart using a repeat region.

We have an option where the user can update the qty per item, this only works on the first item in the recordset and no matter what button you press i.e whichever line the qty is updated on the first product only.

See code below, any suggestion would be appreciated:

While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
<form action="<%=MM_editAction%>" METHOD="POST" name="form1">
    <td class="image">
      <a href="shop.asp?sku=<%=Recordset1.Fields("sku")%>&sessionx=<%=Recordset1.Fields("sessionx")%>"> <img class="img-fluid" src="<%=(Recordset1.Fields.Item("image").Value)%>" alt=""/></a>
    <td class="description">
       <a href="shop.asp?sku=<%=Recordset1.Fields("sku")%>&sessionx=<%=Recordset1.Fields("sessionx")%>"><%=(Recordset1.Fields.Item("name").Value)%></a>
    <td class="price">£<%=(Recordset1.Fields.Item("totalprice").Value)%></td>
    <td class="td-quentety">
      <input type="number" value="<%=(Recordset1.Fields.Item("qty").Value)%>" name="qty">
    <td class=""><a class="button mt-10" href="#" onclick="document.forms['form1'].submit(); return false;">Update</a>
      <input type="hidden" name="MM_update" value="form1">
      <input type="hidden" name="MM_recordId" value="<%= Recordset1.Fields.Item("idx").Value %>">
    <form ACTION="<%=MM_editAction%>" METHOD="POST" name="form2">
    <td class=""><a class="button mt-10" href="#" onclick="document.forms['form2'].submit(); return false;">Remove</a></td>
  <input type="hidden" name="MM_delete" value="form2">
  <input type="hidden" name="MM_recordId" value="<%= Recordset1.Fields.Item("idx").Value %>">

Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.03 -
Copyright ©2001-2019 Web Wiz Ltd. -