Hi all,

I have a CGI script which does a select on a database and builds a checkbox group iterating through the result of the select. The problem is when a user submits the form, only the first checked item in the checkbox group is passed.
Below is the snippet of the perl code that generates the checkbox group. Please advise me if there is anything I am doing wrong. Any help is appreciated.


Thanks,
Prachi.

### cut code ####
if (!$sth) {
     $sth = $dbh->prepare("SELECT * FROM " . $schema .
        "dberge_ranges WHERE chrom = ? " .
         "AND start_pt <= ? AND stop_pt >= ? ORDER BY id, start_pt");
  }
  $sth->execute($chr, $stp, $st);
  my(@row) = $sth->fetchrow_array;
   #print "@row\n";
  if ([EMAIL PROTECTED]) {
     print $q->strong("No  results and Expression data found\n"), $q->br;
  }else {
     print $q->strong("Experimental results of gene expression"), $q->br;
     print $q->start_form(-action => $dberge_url);
     print $q->br;
     print $q->start_table({-border=>1}), $q->Tr,
           $q->td("ExperimentID  Assay"),
           $q->td("range affected");
     my $pid = 0;
     while (@row) {
        $row[3] = commify($row[3]);
        $row[4] = commify($row[4]);
        if ($pid == $row[0]) { #same variant another range
           if ($row[3] ne $row[4]) {
              print $q->br, "$row[2] $row[3] - $row[4]";
           }else {
              print $q->br, "$row[2] $row[3]";
           }
        }else { #new dberge entry
            print $q->Tr;
           print $q->td( $q->checkbox(-name=>'id',
                                      -value=>$row[0],
                                      -label=>"$row[0] $row[1]"));
           if ($row[3] ne $row[4]) {
              print $q->td, "$row[2] $row[3] - $row[4]"; #may continue
           }else {
              print $q->td, "$row[2] $row[3]";
           }
        }
        $pid = $row[0];
        @row = $sth->fetchrow_array;
     }
     print $q->br;
     print $q->end_table;
     print $q->br;

    print $q->hidden("mode", "Submit query"),
           $q->hidden("disp","All data");
     print $q->submit(-name=>"View", -value=>"Submit");

#### end cut code ###

_________________________________________________________________
Chat privately with Bon Jovi, Seal, Bow Wow, or Mary J Blige using MSN Messenger! http://www5.msnmessenger-download.com/imastar/default.aspx



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



Reply via email to