php - When submitting this button inside a datatable doesnt submit the right row id

one text

Solution:

You have multiple <input> elements with the same name within your form, and all of them are going to be submitted when you submit the form, but PHP can only get one of them. That's why you end up with only the last one in $_POST.

It looks like you should be able to fix this by just moving some attributes from the hidden input into the button (replacing the hidden input).

<button type="submit" name="device_id_breakage" value="<?php echo $cases["Dev_Id"]; ?>">
    See RMA
</button>

Only the button that was clicked will be submitted. Note that after changing the name of the button, you won't have see_rma in $_POST any more, so if you have any code that depends on that you'll need to change it to look for the other name instead.

Source