[sf-perl] Bulk Delete check boxes
ken uhl
kenuhl at berkeley.edu
Tue Feb 26 16:42:00 PST 2008
Hi,
maybe this will illustrate what I am trying to do:
shebang perl -
#
# BULK_delete.pl
use CGI;
my $sq = new CGI;
use DBI;
my $db = new DBI;
# code snipped from library module
my $db_query = "select * from table";
my $dbh = $db->pepare($db_query);
my @db_queryresults = $dbh execute();
# render the DB query to HTML table
my @lines ; # array for print
for my $db_line (@db_queryresults) {
# get the table row id from results
$hrowid = @db_queryresults->[4];
# make a uniquely named check box
my $be_bad = $sq->checkbox( -name => "bulkdeleteHost_$hrowid",
-checked => 0, -value => "FALSE", -label => " Bulk Delete ") ;
# append check box to html table
push(@lines, $sq->td($be_bad) );
# append some other data from table to display
push(@lines, $sq->td(@db_queryresults->[2] ));
print @lines;
...
# from library
1708 sub _dnsURL {
1709 my $q = shift; # CGI handle
1710 my $dir = shift; # CGI subdirectory
1711 my $script = shift; # script to run
1712 my $qparam = shift; # hasref to additional named CGI params
1713
1714 my $sq = new CGI;
1715 $sq->delete_all;
1716 $sq->param(-name => 'AWSAuthToken', -value =>
$q->param('AWSAuthToken'));
1717 $sq->param(-name => 'AWSSignatureBase64',
1718 -value => $q->param('AWSSignatureBase64'));
1719
1720 foreach (keys %$qparam) {
1721 $sq->param(-name => $_, -value => $qparam->{$_});
1722 }
1723
1724 return "/cgi-bin/dns-db/" . "$dir/$script?" .
$sq->query_string;
1725 }
# ------------------------------
Question :
This displays HTML table of data base rows with Bulk Delete check box.
how do I render a confirmation page of just the selected records?
Should I do this in the same CGI script, or pass all the data to
another script?
I looked at CGI::checkbox_goup as a means to parse all the values,do I
need another action /submit button to drive that ?
Ken
berkeley
More information about the SanFrancisco-pm
mailing list