I have this code on php
for ($i=0;$i<$myCounter;$i++) {
$inum++; //showing only by the counter.
echo "<hr>ID de Producto ".$inum.":".$dataReceive[$i]["Detalle"]["IDENDODET"];
echo '
<form method="POST">
<input type="hidden" name="IDENDODET" id="IDENDODET" class="IDENDODET" value="'.$dataReceive[$i]["Detalle"]["IDENDODET"].'">
<button type="button" id="Delete" name="Delete" style="border:0;background-color:yellow;" onclick="deletecookieTest()"/>Borrar este ID</button>
</form>';
}
And I want the value from the IDENDODET to be sent with the button clicked. I've tried this:
var form = document.querySelector('input[name=IDENDODET]').value;
but that only gives me the first value when the button is clicked instead of the value of the form in particular. For example no matter which button I click below I get "165" instead of "167" which I need to later delete that section. here is what it looks like