[sf-perl] Bulk Delete check boxes

Matthew Lanier matt at cloudfactory.org
Tue Feb 26 17:55:35 PST 2008


Hi Ken-

(I'm not replying on the technicalities of your request, more on the 
format).

In the future, the content of this message below is much more in line with 
what is required when asking a technical question of the sfpug.  I think 
sufficient information is present at this point.

thanks-

m@

  On Tue, 26 Feb 2008, ken 
uhl wrote:

> 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
>
>
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
>

-- 

Matthew D. P. K. Strelchun-Lanier
matt at cloudfactory.org
http://www.bearlywornpacifica.com


More information about the SanFrancisco-pm mailing list