// foreach $dbarray foreach ($dbarray as $k => $v) { // set del flag $delflag = true; $val_tantou_name = ""; $val_mail_address = ""; foreach ($forms['mutirow'] as $kk => $vv) { if ($v['id'] == $vv['id']) { $delflag = false; $val_tantou_name = $vv['tantou_name']; $val_mail_address = $vv['mail_address']; } } if ($delflag) { // remove data if ($tantou_dao->remove($v['id'])) { } else { $executeflg = false; } } else { $values = array(); $values['corporate_id'] = $forms['id']; $values['tantou_name'] = $val_tantou_name; $values['mail_address'] = $val_mail_address; // update data if ($tantou_dao->edit($v['id'], $values)) { } else { $executeflg = false; } } }