This looks overcomplicated... I think you can just use this code in place of lines 51-71:
<?php
if (isset($_POST["UpdateOrder"])) {
mysql_select_db($database_PowerCMSConnection, $PowerCMSConnection);
$OrderArray = array();
$start = 1;
while (isset($_POST["ProductID_".$start])) {
mysql_query("UPDATE products SET ProductOrder = ". intval($_POST["ProductOrder_".$start]) ." WHERE ProductID = " . intval($_POST["ProductID_".$start]), $PowerCMSConnection) or die(mysql_error());
$start++;
}
}
?>
You will also have to add that ProductID hidden form to your repeat region... something like:
<input name="ProductID_<?php echo($curOrder); ?>" value="<?php echo($row_WADAproduct_order['ProductID']); ?>" type="hidden" >
If you want to set up a premier support ticket I can show you how to do drag/drop reordering at some point.