diff -ru old/lib/HTML/Form.pm new/lib/HTML/Form.pm
--- old/lib/HTML/Form.pm	Tue Nov 30 03:25:00 2004
+++ new/lib/HTML/Form.pm	Fri Dec  3 00:44:02 2004
@@ -96,7 +96,7 @@
     my $p = HTML::TokeParser->new(ref($html) ? $html->decoded_content(ref => 1) : \$html);
     eval {
 	# optimization
-	$p->report_tags(qw(form input textarea select optgroup option keygen));
+	$p->report_tags(qw(form input textarea select optgroup option keygen label));
     };
 
     unless (defined $base_uri) {
@@ -122,12 +122,34 @@
 			     $attr->{'enctype'});
 	    $f->{attr} = $attr;
 	    push(@forms, $f);
+	    my(%labels, $current_label);
 	    while (my $t = $p->get_tag) {
 		my($tag, $attr) = @$t;
 		last if $tag eq "/form";
-		if ($tag eq "input") {
+		if ($tag eq "label") {
+		    $current_label = $p->get_phrase;
+		    $labels{ $attr->{for} } = $current_label
+		        if exists $attr->{for};
+		}
+		elsif ($tag eq "/label") {
+		    $current_label = undef;
+		}
+		elsif ($tag eq "input") {
 		    my $type = delete $attr->{type} || "text";
-		    $attr->{value_name} = $p->get_phrase;
+
+		    if(exists $attr->{id} && exists $labels{$attr->{id}}) {
+			      $attr->{value_name} = $labels{$attr->{id}};
+		    }
+		    else {
+			      $attr->{value_name} = defined $current_label
+			          ? $current_label . " " . $p->get_phrase
+			          : $p->get_phrase;
+
+			      $attr->{value_name} =~ s/\A\s+//;
+			      1 while $attr->{value_name} =~ s/\s\z//;
+			      $attr->{value_name} =~ s/\s+/ /;
+		    }
+
 		    $f->push_input($type, $attr);
 		}
 		elsif ($tag eq "textarea") {
diff -ru old/t/html/form.t new/t/html/form.t
--- old/t/html/form.t	Mon Nov 15 06:45:42 2004
+++ new/t/html/form.t	Fri Dec  3 01:07:09 2004
@@ -3,7 +3,7 @@
 use strict;
 use Test qw(plan ok);
 
-plan tests => 98;
+plan tests => 102;
 
 use HTML::Form;
 
@@ -447,3 +447,27 @@
 ok(@f, 2);
 ok($f[0]->find_input("s"));
 ok($f[1]->find_input("t"));
+
+$f = HTML::Form->parse(<<EOT, "http://www.example.com");
+<form  ACTION="http://example.com/">
+  <fieldset>
+    <label>
+      <input type=radio name=l0 value=0 />zero
+    </label>
+    <label>one
+      <input type=radio name=l1 value=1>
+    </label>
+    <label for="l2">two</label>
+    <input type=radio name=l2 id=l2 value=2>
+    <label>
+      <span>nested</span>
+      <input type=radio name=l3 value=3>
+    </label>
+  </fieldset>
+</form>
+EOT
+
+ok(join(":", $f->find_input("l0")->value_names), "zero");
+ok(join(":", $f->find_input("l1")->value_names), "one");
+ok(join(":", $f->find_input("l2")->value_names), "two");
+ok(join(":", $f->find_input("l3")->value_names), "nested");
