Index: trunk/cgi-bin/main.cgi
===================================================================
--- trunk/cgi-bin/main.cgi	(revision 943)
+++ trunk/cgi-bin/main.cgi	(revision 944)
@@ -1357,6 +1357,12 @@
   # collect per-IP rDNS fields.  only copy over the ones that actually have something in them.
   my %iprev;
-  foreach (keys %webvar) {
-    $iprev{$_} = $webvar{$_} if /host_[\d.a-fA-F:]+/ && $webvar{$_};
+  foreach (sort keys %webvar) {
+    # skip all but the host_* fields
+    next unless /^host_[\d.a-fA-F:]+/;
+    # propagate the per-IP rDNS if present
+    $iprev{$_} = $webvar{$_} if $webvar{$_};
+    # set the rDNS to be cleared if there was a value before (was_host_* field),
+    # but there's no value in the matching visible form field now (host_*)
+    $iprev{$_} = '' if $webvar{"was_$_"} && !$webvar{$_};
   }
 
