I have a form with several select and text boxes that gets dynamically generated from a database query. The number of rows (The form lives in a html table) depends on how many records gets returned from the database. For instance:
Row 1 - MUStatus(dropdown), IPlan(dropdown), ATT(text box) Row 2 - MUStatus(dropdown), IPlan(dropdown), ATT(text box) Row 3 - MUStatus(dropdown), IPlan(dropdown), ATT(text box) ... ... ... Row 10 - MUStatus(dropdown), IPlan(dropdown), ATT(text box)
Not all rows are going to be updated all the time. Maybe a user gets a 10-row form and updates only one. My processing script needs to loop through all rows to figure out which one has changed in order to update. This causes the update query to run 10 times even if the user only updates one row. How can I get it to update only the number of rows that has been changed on the form?
Currently this is my processing script (not sanatized yet. Just in test mode)
for($i = 0; $i < $_POST['totalRecords']; $i++){
if($_POST['muStatus'] != $providerMUStatusArray[$i] ||
$_POST['att1IncentivePlanDropDown'!= $providerATT1IncentivePlanArray[$i] ||
$_POST['att1AttestationNumber'!= $providerATT1NumberArray[$i]){
UPDATE QUERY GOES HERE
}//END IF
}//END FOR
Any help is appreciated