diff --git a/includes/form.inc b/includes/form.inc
index da53a9330649884d557177f521d5802de517a010..8ac651f748dc2060574add39254aa467d7ca87f0 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -823,7 +823,7 @@ function theme_submit($element) {
 }
 
 function theme_button($element) {
-  return '<input type="submit" class="form-'. $element['#button_type'] .'" name="'. $element['#name'] .'" value="'. check_plain($element['#value']) .'" '. drupal_attributes($element['#attributes']) ." />\n";
+  return '<input type="submit" class="form-'. $element['#button_type'] .'" '. (empty($element['#name']) ? '' : 'name="'. $element['#name'] .'" ') .'value="'. check_plain($element['#value']) .'" '. drupal_attributes($element['#attributes']) ." />\n";
 }
 
 /**