This can be done through PHP as $_POST
is itself an array thus it can be looped.
Say, you have fields :
<input name="dyn[id1]"/>
<input name="dyn[id2]"/>
In the backend PHP file,
Loop through the $_POST
as following:
<?php
if (isset($_POST['SUBMIT_BTN'])) {
if (! empty($_POST['dyn'])) {
foreach ($_POST['dyn'] as $dyn_id => $dyn_val) {
// "$dyn_id" is your ID you needed.
}
}
}
?>