PHP and Jquery pass value from form. Update function on DataBase

Each set of form fields has the same set of field names ([...] is the rest of your code):

<?php foreach ( $myrows as $a ): ?>

    <input id="id" type="text" name="id" value="<?php echo $a->id; ?>">

    [...]

<?php endforeach ?>

If 3 rows are returned in $myrows and the values are fee, fie, foe, the value attribute changes for each field, but the field name is always the same. Here is are the first 3 fields bunched together:

<input id="id" type="text" name="id" value="fee">
<input id="id" type="text" name="id" value="fie">
<input id="id" type="text" name="id" value="foe">

The web server sees only the last value: id = foe fee and fum do not matter.

So, each set of form fields is replaced by the previous set. Define a unique name for each loop. Here is the first form field:

<?php
$row_count = 0;
foreach ( $myrows as $a ): ?>

    <input id="id-<?php echo $row_count; ?>" type="text" name="id-<?php echo $row_count; ?>" value="<?php echo $a->id; ?>">

    [ ... ]

    <?php
    $row_count++;
endforeach; ?>

Replace [ ... ] with you other code.

Now, those same 3 fields would look like this:

<input id="id-0" type="text" name="id-0" value="fee">
<input id="id-1" type="text" name="id-1" value="fee">
<input id="id-2" type="text" name="id-2" value="fee">

You can define the row count in a hidden form variable (outside the foreach loop).

<input type="hidden" name="row_count" value="<?php echo count( $myrows );">

Then, in aad_process2_ajax() loop through all the names and do as many updates as there are rows in the row_count form field.