0

I can show the values in a database, with a checkbox, but can't retrieve rows I checked

When I submit, the only response that I get is the first row, event that I have checked everyone

Here my code

            <table border="1" align="center" valign="center">
                <c:forEach var="row" items="${parcelas.rows}">

                    <form>
                        <td>
                            <input type="checkbox" name="id" value="${row.parcelaID}" >
                        </td>
                    </form>
                    <td><c:out value="${row.parcelaID}"/></td>
                    <td><c:out value="${row.parcelaVencimento}"/></td>
                    <td ><c:out value="${row.parcelaValor}"/></td>
                    <td><c:out value="${row.clienteID}"/></td>

                    <tr></tr>


                </c:forEach>

            </table>
  <input type="submit" value="OK" />

        </form>



<c:forEach var="row" items="${param.id}">
    <c:out value="${row}"/><br/>
</c:forEach>

Edited by Dani: Formatting fixed

3
Contributors
3
Replies
5
Views
7 Years
Discussion Span
Last Post by nohup
0

Try a query on the table using the WHERE command on the checkbox field:

SELECT *
FROM Table1
WHERE (((Table1.Checkbox)=True));

Hope that helps solve your problem.

0

Thanks

Only for not getting me wrong, you mean a select in the HTML table and not the database table .

Correct ?

0

Your resulting code is not valid HTML.
You have multiple form tags and the submit button sends only the data of the first form.

Open and close the <form> tag only once and outside of the <c:forEach>.

Also, it's good practice to give the form an id so that you can refer to it easily (if you use javascript/DOM) and distinguish it from other forms that may exist in the same page.
e.g.

<form id="myform" action="#" method="post">...</form>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.