So the script halves in size and now becomes:

---------------------------------------
#!/usr/bin/perl -w

use CGI qw(:standard);

my $cgi = new CGI;
my %params = $cgi->Vars;


open(COUNTER,"entrycount.txt");
while(<COUNTER>){
  $entrynumber = $_;  ###get previous entry number
  last;
}
close(COUNTER);
open(COUNTER,">entrycount.txt");
$entrynumber++;               ###add one to it
print COUNTER "$entrynumber";   ###write the new value to file
                                ###and close it again for next time
close(COUNTER);

open(OUTFILE,">>tabdelimited.txt"); #open the final file
                                    #write the tab-delimited results to it
print OUTFILE 
"$entrynumber\t$params{q1_1}\t$params{q1_2}\t$params{q1_3}\t$params{q1_4}\t$
params{q1_5}\t$params{q1_6}\t$params{q1_7}\t$params{q1_8}\t$params{q1_9}\t$p
arams{q1_10}\t$params{q1_11}\t$params{q1_12}\t$params{q1_13}\t$params{q1_14}
\t$params{q1_15}\t$params{q1_16}\t$params{q1_17}\t$params{q1_18}\t$params{q1
_19}\t$params{q1_20}\t$params{q1_21}\t$params{q1_22}\t$params{q1_23}\t$param
s{q1_24}\t$params{q1_25}\t$params{q1_26}\t$params{q1_27}\t$params{q1_28}\t$p
arams{q1_29}\t$params{q1_30}\t$params{q1_31}\t$params{q1_32}\t$params{q1_33}
\t$params{q1_34}\t$params{q1_35}\t$params{q1_36}\t$params{q1_37}\t$params{q1
_38}\t$params{q1_39}\t$params{q1_40}\t$params{q1_41}\t$params{q1_42}\t$param
s{q1_43}\t$params{q1_44}\t$params{q1_45}\t$params{q1_46}\t$params{q1_47}\t$p
arams{q1_48}\t$params{q1_49}\t$params{q1_50}\t$params{q1_51}\t$params{q1_52}
\t$params{q1_53}\t$params{q1_54}\t$params{q1_55}\t$params{q1_56}\t$params{q1
_57}\t$params{q1_58}\t$params{q1_59}\t$params{q1_60}\t$params{q1_61}\t$param
s{q1_62}\t$params{q1_63}\t$params{q1_64}\t$params{q1_65}\t$params{q1_66}\t$p
arams{q1_67}\t$params{q1_68}\t$params{q1_69}\t$params{q1_70}\t$params{q1_71}
\t$params{q7_1}\t$params{q7_2}\t$params{q7_3}\t$params{q7_4}\t$params{q7_5\t
$params{q7_6}\t$params{q7_7}\t$params{q7_8}\t$params{q7_9}\n";
close(OUTFILE);

print "Content-Type: text/html\n\n";  ###HTML page asking "Do you want to
                                      ###enter another questionnaire
                                      ###result, or view raw data so far?
print '<P><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0"
WIDTH="550"><TR><TD><CENTER><H3><BR>Entry #'."$entrynumber".' successfully
entered.<BR></H3><H3>Please choose from selection below:</H3><H3><TABLE
BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%"><TR><TD
WIDTH="48%"><P ALIGN="RIGHT"><A HREF="../submit.html"><IMG SRC="submit.gif"
WIDTH="188" HEIGHT="141" ALIGN="BOTTOM" BORDER="0"></A></TD><TD
WIDTH="20">&nbsp;</TD><TD WIDTH="48%"><A HREF="tabdelimited.txt"><IMG
SRC="viewdata.gif" WIDTH="188" HEIGHT="141" ALIGN="BOTTOM"
BORDER="0"></A></TD></TR></TABLE></CENTER></TD></TR></TABLE>';

-------------------------------------

Haven't tested it yet, but I'm pretty sure she'll work.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to