There are also modules to take care of this kind of thing.
Take a look at
this node where I give sample code for creating
a form and table. Generating your code programattically
guarantees that you don't miss any closing tags, and that
your HTML is structured properly. It's worth a look, and
it makes stuff much easier to maintain, and easier to see
the page logic.
xoxo,
Andy
%_=split/;/,".;;n;u;e;ot;t;her;c; ". # Andy Lester
'Perl ;@; a;a;j;m;er;y;t;p;n;d;s;o;'. # http://petdance.com
"hack";print map delete$_{$_},split//,q< andy@petdance.com >