[ci skip] Fix a false default-fallback bug in set_checkbox(), set_radio()

Relevant: #4210
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index fd80776..37dafd9 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -769,12 +769,11 @@
 		{
 			return $CI->form_validation->set_checkbox($field, $value, $default);
 		}
-		elseif (($input = $CI->input->post($field, FALSE)) === NULL)
-		{
-			return ($default === TRUE) ? ' checked="checked"' : '';
-		}
 
+		// Form inputs are always strings ...
 		$value = (string) $value;
+		$input = $CI->input->post($field, FALSE);
+
 		if (is_array($input))
 		{
 			// Note: in_array('', array(0)) returns TRUE, do not use it
@@ -789,7 +788,13 @@
 			return '';
 		}
 
-		return ($input === $value) ? ' checked="checked"' : '';
+		// Unchecked checkbox and radio inputs are not even submitted by browsers ...
+		if ($CI->input->method() === 'post')
+		{
+			return ($input === 'value') ? ' checked="checked"' : '';
+		}
+
+		return ($default === TRUE) ? ' checked="checked"' : '';
 	}
 }
 
@@ -816,12 +821,32 @@
 		{
 			return $CI->form_validation->set_radio($field, $value, $default);
 		}
-		elseif (($input = $CI->input->post($field, FALSE)) === NULL)
+
+		// Form inputs are always strings ...
+		$value = (string) $value;
+		$input = $CI->input->post($field, FALSE);
+
+		if (is_array($input))
 		{
-			return ($default === TRUE) ? ' checked="checked"' : '';
+			// Note: in_array('', array(0)) returns TRUE, do not use it
+			foreach ($input as &$v)
+			{
+				if ($value === $v)
+				{
+					return ' checked="checked"';
+				}
+			}
+
+			return '';
 		}
 
-		return ($input === (string) $value) ? ' checked="checked"' : '';
+		// Unchecked checkbox and radio inputs are not even submitted by browsers ...
+		if ($CI->input->method() === 'post')
+		{
+			return ($input === 'value') ? ' checked="checked"' : '';
+		}
+
+		return ($default === TRUE) ? ' checked="checked"' : '';
 	}
 }