All good tips above. I'd like to add one more note about a personal style preference that makes it easier for me to keep track of form elements.
#build form elements
my $openform = start_form( { -action => "action_dbi.cgi",
-enctype => "application/x-www-form-urlen
+coded",
-method => "post" } );
my $chk_question = checkbox_group(-name=>'question',
-values=>['yes','no'],
-default=>['yes']);
my $cmd_submit = input( { -type => "submit",
-value => "submit"} );
#print form
print <<End_of_Form;
$openform
h1( strong( "Does this format look correct?" ) )
$chk_question
p( " " )
p( $cmd_submit)
end_form()
End_of_Form
This code would replace the code for the form you posted. Basicly I'm putting the results of the functions that generate the form elements into variables and interpolating them into a here document. It makes the here document easier to read and it groups your form elements together to make then easier to edit/update.
John
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.