Below is my code, but I want it to add rows each time if necessary. So when I press submit it would bring up the same form again but display the previously added data to the form. When done, then it would send all 6 (or however many) rows of data.
Code:
use CGI;
$q = new CGI;
print $q->header;
print $q->start_html;
unless($q->param) {
print $q->start_form('New Request');
print "<H1>New Request</H1><hr>\n";
print "<P>Name:", $q->textfield('From', '', 20, 60);
print "<P>Phone:", $q->textfield('phone', '', 20, 60);
print "<P>Date:", $q->textfield('today', '', 20,60);
print "<P>Completion date:", $q->textfield('completion', '', 20, 60);
print "<PRE>";
print "<P>To:", $q->popup_menu('Recipient',$RECIP);
print "<P>Entry type:",$q->popup_menu('Entry',$ENTRY);
print "<P>Subnet:",$q->textfield('IP', '', 20, 20);
print "Hostname: ",$q->textfield('Hostname', '', 20, 60);
print "<P>Domain:", $q->popup_menu('Domain',$DOMAIN);
print "Comments: ", q->textfield('Comments', '', 20, 60);
print "</PRE>";
print "<H2>Mail this request</H2>";
print "<P>", $q->checkbox_group('Mail_me', $PAGE);
print "<hr>";
print "<P>", $q->submit('Submit');
print $q->end_form;
} else {
$requester = $q->param('From');
print "<H1>New Request Complete</H1><hr>\n";
print "<P>New entries:", $q->param('Entry'), $q->param('IP'),
$q->param('Hostname'), $q->param('Domain'), $q->param('Comments');
if ($requester && (@interest = $q->param('Mail_me'))) {
print "<P>You will receive e-mail whenever the ";
for (@interest) {
SWITCH:{
/DNS/ && do {
print "DNS ";
last SWITCH;
};
/Port/ && do {
print "Port ";
last SWITCH;
};
my $x = 1;
}
}
print "entries need updated.";
}
print "<hr>";
print "<H3>Debug Parameter Dump</H3>", $q->dump, "<hr>" if $DEBUG;
}
print $q->end_html;