Web Wiz - Solar Powered Eco Web Hosting

  New Posts New Posts RSS Feed - Form/Database Update only applying to first record
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Form/Database Update only applying to first record

 Post Reply Post Reply
Author
lee2121 View Drop Down
Newbie
Newbie
Avatar

Joined: 13 January 2017
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote lee2121 Quote  Post ReplyReply Direct Link To This Post Topic: Form/Database Update only applying to first record
    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">
  <tr>
    <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>
    <td class="description">
       <a href="shop.asp?sku=<%=Recordset1.Fields("sku")%>&sessionx=<%=Recordset1.Fields("sessionx")%>"><%=(Recordset1.Fields.Item("name").Value)%></a>
    </td>
    <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>
    <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>
    </td>
    <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>
  </tr>
  <input type="hidden" name="MM_delete" value="form2">
  <input type="hidden" name="MM_recordId" value="<%= Recordset1.Fields.Item("idx").Value %>">
    </form>
  <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Recordset1.MoveNext()
Wend
%>
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.07
Copyright ©2001-2024 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Policy

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2024 Web Wiz Ltd. All rights reserved.