sub list_records
{
    my( $dbh ) = @_;

    print &topp;
    print "<h1>Lista poster</h1>\n";
    print "<form>\n";

    my $sql = "select * from person";
    my $sth = $dbh->prepare( $sql );
    $sth->execute or die(  "< $sql > $DBI::errstr" );

    print "<table border>\n";
    print "<tr><th>Id <th>Förnamn <th>Efternamn <th>Född\n";
    while( my $rr = $sth->fetchrow_hashref )
    {
	# Se till så att fälten inte innehåller HTML-kod
	# Ge tomma fält sina defaultvärden
	my $id    = CGI::escapeHTML( $rr->{'id'} )    or die "Rad utan id";
	my $fnamn = CGI::escapeHTML( $rr->{'fnamn'} ) || "";
	my $enamn = CGI::escapeHTML( $rr->{'enamn'} ) || "";
	my $fodd  = CGI::escapeHTML( $rr->{'fodd'} )  || 0;

	print "<tr><td><input type=radio name=id value=\"$id\"> $id\n";
	print "<td>$fnamn <td>$enamn <td>$fodd\n";
    }
    print "</table>\n";

    print "<p>State: <input type=radio name=state value=view_record> Visa post\n";
    print "<p><input type=submit>\n";
    print "</form>\n";
    print &bottom;
}

1;
