mnlight has asked for the wisdom of the Perl Monks concerning the following question:

I have a script that selects 3 columns (Day, Date, and Number) from a database. Each row is displayed in a 4 column table. The first column has checkboxes so the a user can select which day they would like to sign up. For each selection I would like to take the information and write it to a file that can be used by a second script that will update the table with the remote_user() name. The user must also identify themselve as Father or Mother which I would also like to write to the file. To see how it looks go to. www.mnlightning90.org/cgi-bin/Volunteer.pl
print $query->start_form('POST','./Signup.pl'); print $query->radio_group( -name =>'Parent', -value =>["Father", "Mother"], -default=>["NO DEFAULT"], -linebreak=>'true', -columnheader=>'Parent'); print "<TABLE BORDER='1' CELLSPACING='1' CELLPADDING='7'>"; print "<TR>"; print "<TH WIDTH='10%' VALIGN='TOP' BGCOLOR='#9933FF'>"; print "<FONT SIZE='2' COLOR='#FFFFFF'>Volunteer</TH>"; print "<TH WIDTH='10%' VALIGN='TOP' BGCOLOR='#9933FF' align='center'>" +; print "<FONT SIZE='2' COLOR='#FFFFFF'>Day</TH>"; print "<TH WIDTH='10%' VALIGN='TOP' BGCOLOR='#9933FF' align='center'>" +; print "<FONT SIZE='2' COLOR='#FFFFFF'>Date</TH>"; print "<TH WIDTH='10%' VALIGN='TOP' BGCOLOR='#9933FF' align='center'>" +; print "<FONT SIZE='2' COLOR='#FFFFFF'>Number</TH>"; print "</TR>"; while (my @val = $sth->fetchrow_array ()) { print "<TR>"; print "<TD WIDTH='10%' VALIGN='TOP' ALIGN='center'BGCOLOR='#99FF99' +COLOR='#FFFFFF'>"; print $query->checkbox_group(-name=>'choice', -values=>'');</TD>; #print "<A HREF=./Signup.pl?$val[2]&$val[3]></TD>"; print "<TD WIDTH='10%' VALIGN='TOP' BGCOLOR='#99FF99' align='center' +>"; print "<FONT SIZE='2' COLOR='#9933FF'>$val[0]</TD>"; print "<TD WIDTH='10%' VALIGN='TOP' BGCOLOR='#99FF99' align='center' +>"; print "<FONT SIZE='2' COLOR='#9933FF'>$val[1]</TD>"; print "<TD WIDTH='10%' VALIGN='TOP' BGCOLOR='#99FF99' align='center' +>"; print "<FONT SIZE='2' COLOR='#9933FF'>$val[2]</TD>"; print "</TR>"; } print "</TABLE>"; print "<p>"; print $query->submit(-name=>'rows', -value=>'Submit'); print " "; print $query->reset; print $query->end_form();

Replies are listed 'Best First'.
Re: Putting form names into a tmp file to be used by a new script
by grep (Monsignor) on Dec 24, 2001 at 12:14 UTC
    mnlight I do not understand why you want to put it out to a tmp file. You can create a dispatch table at the top of your CGI script. This script could produce the form and take the results and make the change to the DB. If you have security issues with the DB that you are concerned about I can help you set it up correctly if you have some more details. Also you have your website protected by htaccess and you did not supply a user name and password

    Other than that, a couple of things I noticed in your script -
    You use a lot of font tags - you should factor all that style info to a CSS. Here is a good link about CSS written by Ovid
    You are not using all the nice features of CGI.pm like building your table for you
    Personally I avoid HTML tags in code it's easier to read code.

    grep
    grep> cd pub 
    grep> more beer