the if statement that you have around the form elements:
<?php /*START_PHP_SIRFCIT*/ if ($row_rsPages['pg_id']<>"1"){ ?>
<input type="hidden" name="WADA_RepeatID_pg_id_<?php echo $RepeatSelectionCounter_1; ?>" id="WADA_RepeatID_pg_id_<?php echo $RepeatSelectionCounter_1; ?>" value="<?php echo $row_rsPages["pg_id"]; ?>" />
<input name="txtSortOrder_<?php echo $RepeatSelectionCounter_1; ?>" type="text" id="txtSortOrder_<?php echo $RepeatSelectionCounter_1; ?>" value="<?php echo $row_rsPages['pg_sortorder']; ?>" size="3" />
<?php } /*END_PHP_SIRFCIT*/ ?>
should go around the entire repeat region, it is probably causing the indexes being written by the $RepeatSelectionCounter_1 to be out of synch thus causing the update to fail.