如何在HTML中正确设置多个表单?

How can I properly set multiple forms in HTML?

提问人:Ángel X. 提问时间:10/30/2023 最后编辑:SamÁngel X. 更新时间:10/30/2023 访问量:22

问:

我目前正在尝试在我的购物车中设置多个表单,但只有一个可以正常工作。

id = “bookToRemove” 的表单可以达到预期目的,但“bookToUpdate”表单不会重定向到“updatequantity.jsp”。

下面是供参考的当前代码:

<tr>
    <th><img src="<%=getItemsonCart.getString(6)%>"  style="height:83px; width:50px;"></th>
    <th>Book: <%=getItemsonCart.getString(3)%></th>
    <th>$<%=getItemsonCart.getString(4)%></th>
    <th>Quantity: <%=getItemsonCart.getString(5)%></th>
    <th>
    <form id = "bookToUpdate" action = "updatequantity.jsp" method = "post">
    <input id="quantofBook" min = "1" type="number" placeholder="Quantity" name = "quantityToUpdate"          required>
    <input id ="bookToUpdate" type = "hidden" value = "<%=getItemsonCart.getString(3)%>" name =     "bookToUpdate">
    <input type = "submit" input = "submit" value = "Update">
    </form>
    </th>
    <th>
    <form id = "bookToRemove" action = "removefromcart.jsp" method = "post">
    <input id = "book" type = "hidden" value = "<%=getItemsonCart.getString(3)%>" name =     "bookToRemove">
    <input type = "submit" input = "submit" value = "Remove">
    </form>
    </th>
</tr>
Java HTML 表单 JSP Web 应用程序

评论


答: 暂无答案