Trying to understand how to write the 'checked'value of
<input type=checkbox name="presider" value="" $myvar> while inside of add_record sub.
Thanks
In the begining
Let us first assume that there was nothing to begin with.
<input type=checkbox name="presider" value="" $myvar> while inside of add_record sub.
Thanks
Code:
#####################################
@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 the begining
Let us first assume that there was nothing to begin with.