Have a call being made to a database and generating a table. I want it so I can use body-parser to know what the id / value / name is of the button I clicked that will correspond to the database entry I want to delete. Is there a way to do that using the form or will I have to add a javascript click handler to each button with the id?
<form action="/deleteQuestion" method="POST">
<tbody>
<% results.forEach(function(r) { %>
<tr>
<th scope="row">
<%= r.Id %>
</th>
<td>
<%= r.Question %>
</td>
<td>
<%= r.Answer %>
</td>
<td>
<%= r.Wrong1 %>
</td>
<td>
<%= r.Wrong2 %>
</td>
<td>
<%= r.Wrong3 %>
</td>
<td>
<button value=<%=r.Id %> name="Delete">Delete</button>
</td>
</tr>
<% }); %>
</tbody>
</form>
nodejs file
app.post('/deleteQuestion', async(req, res) => {
//Won't work the way I want it to
const question = req.body.Delete
})