Trying to understand how to write the 'checked'value of an input type checkbox name="presider" while inside of add_record sub. Thanks
##################################### @fields = ("first","last","position","email","telephone","presider"); sub add_record { $key = time(); $record=$key; foreach $field (@fields){ ${$field} = $q->param($field); ${$field} = filter(${$field}); $record .= "\::${$field}"; } $record .= "\::${$presider}"; print"were inside of add_record sub\n"; unless (-e $database){ open (DB, ">$database") || die "Error creating database. $!\n"; } else { open (DB, ">>$database") || die "Error opening database. $!\n"; } flock DB, $EXCLUSIVE; seek DB, 0, 2; print DB "$record\n"; flock DB, $UNLOCK; close(DB); } # End of add_record subroutine. ########################################3 sub print_add_screen{ print<<HTML; <HTML><HEAD><TITLE>Add a Record</TITLE></HEAD> <BODY BGCOLOR="#FFFFFF"> <CENTER><FONT SIZE=5 FACE="ARIAL"> Add a Record </FONT></CENTER> <P> <FORM ACTION="database.cgi" METHOD=POST> <CENTER> <input type=checkbox name="presider" value="" $myvar> Check here <B> +only</B> if individual is currently a presider <TABLE BORDER=1 CELLSPACING=0> HTML foreach $field (@fields){ print<<HTML; <TR> <TD BGCOLOR="e0e0e0"><B>\u$field:</B></TD> <TD><INPUT TYPE=TEXT NAME="$field"></TD> </TR> HTML } # End of foreach. print<<HTML; <TR> <TD COLSPAN=2 BGCOLOR="e0e0e0"> <CENTER> <INPUT TYPE=SUBMIT NAME=action VALUE="Add Record"> </CENTER> </TD> </TR> </TABLE></CENTER> <P> </FONT> </BODY></HTML> HTML } # End of print_add_screen subroutine.

In reply to Need Help with writing to flat file from add_record sub by cal

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.