Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 18.59 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. use utf8;
  5. use CGI qw/:standard/;
  6. use CGI::Carp 'fatalsToBrowser';
  7. use DBI;
  8. use Math::Combinatorics;
  9. use GD::Graph::bars;
  10.  
  11.  
  12. #======== CONFIGURE ========
  13.  
  14. my %data = (
  15.  
  16.     user        => 'root',
  17.     passwd      => 'xxx',
  18.     database    => 'meccaniche',
  19.     tabella     => 'monotab',
  20.     host        => 'localhost',
  21.     dbfile      => 'ateneo',
  22.     script      => 'ate4.pl',
  23.     yes_color   => 'green',
  24.     no_color    => 'red',
  25.     form_color  => 'blue',
  26.     cell_color  => 'white',
  27.     script      => 'ate4.pl',
  28.     manoscr     => [ qw(B1 C D E1 E2 F F2 H1 H2 K L1 L2 L3 L7 L8 L9 M N N1 O2 P P2 P3 P4 P5 P7 P8 P9 P10 P11 R Th V V1 V2 V4) ],
  29.  
  30. );
  31.  
  32. #======== MAIN ========
  33. if      (param('runmode') eq 'gif')     {gif();exit;}
  34.  
  35. #http_activate();
  36. db_connect();
  37. start_html();
  38.  
  39. if      (param('runmode') eq 'combo' && param('2o3') eq 'coppie')       {combo(2);}
  40. elsif   (param('runmode') eq 'combo' && param('2o3') eq 'terne')        {combo(3);}
  41. elsif   (param('runmode') eq 'compara') {compara();}
  42. elsif   (param('runmode') eq 'cerca')   {cerca_stringa();}
  43. else                                    {body_html();}
  44.  
  45. if      (param('runmode') ne '')        {
  46.                                         svolgi_query();
  47.                                         tabella();
  48.                                         prepara_dati_gif();
  49.                                         stampa_gif();}
  50.                                        
  51.  
  52. end_html();
  53.  
  54. #======== SUB ========
  55.  
  56. ####################################################################
  57. #                                                                  #
  58. #     Sub per l'attivazione dei server                             #
  59. #                                                                  #
  60. ####################################################################
  61.  
  62.  
  63. sub db_connect {
  64.  
  65. my $db_source = "DBI:mysql:database=$data{database};host=$data{host}";
  66. $data{dbh} = DBI->connect( $db_source, $data{user}, $data{passwd} ) or die "Database connection not made: $DBI::errstr";
  67.  
  68. }
  69.  
  70.  
  71. ####################################################################
  72. #                                                                  #
  73. #     Le Sub per la generazione della query                        #
  74. #                                                                  #
  75. ####################################################################
  76.  
  77.  
  78. sub compara {
  79.  
  80.    
  81.     my (@crit_m, @crit_c, @crit_t, @crit_0);
  82.     my $orig = "compara";
  83.     $data{orig} =$orig;
  84.     my @values = @{ $data{manoscr} };
  85.     my %hash = map { ;"$_" => scalar(param("s$_")) } @values;
  86.  
  87.         foreach my $val (keys %hash) {
  88.  
  89.                 if ($hash{$val} eq '') {
  90.  
  91.                     delete $hash{$val};
  92.  
  93.                 } else {
  94.                 }
  95.         }
  96.  
  97.         my @ar;
  98.         my @ar_cri;
  99.         foreach my $chiave (sort keys %hash) {
  100.  
  101.                 push (@ar, "$chiave = '$hash{$chiave}' AND\n");
  102.                
  103.                 if    ($hash{$chiave} eq "t")   {push (@crit_t, $chiave);}
  104.                 elsif ($hash{$chiave} eq "m")   {push (@crit_m, $chiave);}
  105.                 elsif ($hash{$chiave} eq "c")   {push (@crit_c, $chiave);}
  106.                 elsif ($hash{$chiave} eq "0")   {push (@crit_0, $chiave);}
  107.                
  108.         }
  109.  
  110.  
  111. ########## Formattazione del criterio di ricerca ############
  112.        
  113.         $data{crit_t} = join(', ', @crit_t);
  114.         $data{crit_m} = join(', ', @crit_m);
  115.         $data{crit_c} = join(', ', @crit_c);
  116.         $data{crit_0} = join(', ', @crit_0);
  117.        
  118.         my $criterio = "<br><b><i>Si\':</b><font color=$data{yes_color}>$data{crit_t}</font><br><b>No:</b><font color=$data{no_color}>$data{crit_0}</font></i>";
  119.        
  120.        
  121. ########## Aggiunta alla query dell'opzione lezione esatta/errata ############
  122.  
  123.         my $cerca = join(' ', @ar);
  124.         my $esaerra;
  125.         my $esa = param('esatta');
  126.         my $erra = param('errata');
  127.         my $query_p3;
  128.         $cerca=~ s/ AND$//;
  129.        
  130.             my $query_p1= "SELECT distinct id_pc FROM $data{tabella}\n WHERE ";
  131.  
  132.         if ($cerca && ($esa eq 'esa') && ($erra eq 'err')) {
  133.  
  134.                 $query_p3=' AND esaerra >= 0';
  135.                 $esaerra="esaerra";
  136.  
  137.         } elsif ($cerca && ($esa eq 'esa')) {
  138.  
  139.                 $query_p3=' AND esaerra = 0';
  140.                 $esaerra="esa";
  141.                
  142.         } elsif ($cerca && ($erra eq 'err')) {
  143.  
  144.                 $query_p3=' AND esaerra > 0';
  145.                 $esaerra="erra";
  146.                
  147.         } else {
  148.  
  149.  
  150.         }
  151.         $data{esaerra} = $esaerra;
  152.         $data{cerca} = $cerca;
  153.         $data{query} = $query_p1.$cerca.$query_p3;
  154.         $data{criterio} = $criterio;
  155. }
  156.  
  157. sub cerca_stringa {
  158.  
  159.         my $orig = "cerca";
  160.         $data{orig} =$orig;
  161.         my $criterio = param('cerca');
  162.  
  163.         my $pre= "\n\nSELECT distinct id_pc FROM $data{tabella} WHERE \n";
  164.         my $luo="(id_pc ='". $criterio ."'\nOR\n";
  165.         my $lin="posizione ='". $criterio ."'\nOR\n";
  166.         my $forma="forma LIKE '%". $criterio ."%'\nOR\n";
  167.         my $tipo="tipo LIKE '%". $criterio ."%'\)\n";
  168.  
  169.         my $cerca = $luo . $lin . $forma .$tipo;
  170.         my $query= $pre .$cerca;
  171.        
  172.         $data{cerca} = $cerca;
  173.         $data{query} = $query;
  174.         $data{criterio} = $criterio;
  175. }
  176.  
  177.  
  178. sub combo {
  179.  
  180.         my $orig = "combo";
  181.         $data{orig} =$orig;
  182.         my $count = shift;
  183.         my @m = @{ $data{manoscr} };
  184.         my $combinat = Math::Combinatorics->new(count => $count, data => [@m] );
  185.  
  186.         while (my @combo = $combinat->next_combination) {
  187.                 $data{combo} = \@combo;
  188.                 crea_combo_queries();
  189.           }
  190.          
  191.     prepara_dati_gif();
  192.     stampa_gif();
  193.     end_html();
  194.     exit;      
  195. }
  196.  
  197.  
  198. sub crea_combo_queries {
  199.  
  200.     my $pass2;
  201.     my $cerca = param('menu');
  202.     my @combo = @{ $data{combo} };
  203.     my @m = @{ $data{manoscr} };
  204.    
  205.      if((grep {$_ eq $cerca} @combo) || $cerca eq 'tutte') {
  206.  
  207.                 my $criterio = join(' ', @combo);
  208.                 my @crit_t=();
  209.                 my @crit_0=();
  210.                 my @ar=();
  211.                 my $query;
  212.                 my %combina=();
  213.  
  214.                 foreach my $m (@m) {
  215.  
  216.                     if (grep {$m eq $_} @combo)   {
  217.                         $combina{$m}="t";
  218.  
  219.                 } else {
  220.                         $combina{$m}="0";
  221.  
  222.                         }
  223.                 }
  224.              
  225.             my @keys = sort_alfanum(keys %combina);
  226.            
  227.             foreach my $key (@keys) {
  228.                 push (@ar, "$key = \'$combina{$key}\' AND \n");
  229.             }
  230.  
  231.             $data{cerca} = join(' ', @ar);
  232.             my $pre= "SELECT distinct id_pc FROM $data{tabella} WHERE \n";
  233.  
  234.             $data{cerca}=~ s/ AND\s*$/ /;
  235.             $query = $pre .$data{cerca};
  236.        
  237.             $data{query} = $query;
  238.            
  239.             $data{criterio} = join(', ', @combo);
  240.            
  241.             svolgi_query();
  242.             tabella();
  243.         } else {
  244.        }
  245. }
  246.  
  247.  
  248. ####################################################################
  249. #                                                                  #
  250. #   Le Sub per la generazione dei dati da passare al grafico       #
  251. #                                                                  #
  252. ####################################################################
  253.  
  254.  
  255. sub prepara_dati_gif {
  256.        
  257.         my $serba = $data{tutte_colored};
  258.         my @ariserba2 = split(/, /, $serba);
  259.        
  260.         foreach my $value (@ariserba2) {
  261.                 $value =~ s/^<b><font.+?>(.+?)<\/font><\/b>$/$1/;
  262.                 $value =~ s/[cm]$//;
  263.         }
  264.        
  265.         my $query_gif;
  266.         my %hash_data;
  267.        
  268.         $hash_data{$_}++ foreach @ariserba2;
  269.        
  270.         while (my ($key, $value) = each (%hash_data)) {
  271.             my $elem="$key=$value&";
  272.             $query_gif = $query_gif.$elem;
  273.         }
  274.         $data{query_gif} = $query_gif;
  275. }
  276.  
  277.  
  278.  
  279.  
  280. ####################################################################
  281. #                                                                  #
  282. #     Le Sub per la generazione delle risposte: tabella e grafico  #
  283. #                                                                  #
  284. ####################################################################
  285.  
  286. sub svolgi_query {
  287.  
  288.     my $query = $data{query};
  289.     my $numero_match;
  290.     my @tab_array;
  291.     my $conta;
  292.     my $pc_id_ref;
  293.     my ($query_match, $match_ref, $query_esatta, $esatta_ref, $query_altrirec, $altrirec_ref);
  294.     $data{numero_occ}=0;
  295.  
  296.         $data{dbh}->do("SET NAMES 'utf8'");
  297.         $pc_id_ref  = $data{dbh}->selectall_arrayref($query) or die "$DBI::errstr";
  298.        
  299.         my $max = calcola_max_col($pc_id_ref);
  300.        
  301.     if ($max>=0) {
  302.        foreach my $riga_ref (@$pc_id_ref) {
  303.        
  304.         my $query_match = "SELECT * FROM $data{tabella} WHERE ".$data{cerca} ."AND id_pc = ".$riga_ref->[0];
  305.         my $match_ref   =  $data{dbh}->selectall_arrayref($query_match) or die "$DBI::errstr";
  306.  
  307.         my $query_esatta = "SELECT * FROM $data{tabella} WHERE id_pc = ".$riga_ref->[0] ." AND id_varianti !=" .$match_ref->[0][2] ." AND esaerra =0";
  308.         my $esatta_ref   =  $data{dbh}->selectall_arrayref($query_esatta) or die "$DBI::errstr";
  309.  
  310.         my $query_altrirec = "SELECT * FROM $data{tabella} WHERE id_pc = ".$riga_ref->[0] ." AND id_varianti !=" .$match_ref->[0][2] ." AND esaerra =1";
  311.         my $altrirec_ref   = $data{dbh}->selectall_arrayref($query_altrirec) or die "$DBI::errstr";
  312.    
  313.        
  314.               my ($match_mss_list) =@$match_ref;
  315.               my $colored_list = stampa_mss(@$match_mss_list);
  316.               $data{tutte_colored} = $data{tutte_colored} .", " .$colored_list;
  317.              
  318.               if ($match_ref->[0][3] eq "0") {
  319.                    
  320.                     push (@tab_array, "<tr><td>$match_ref->[0][0]</td><td>$match_ref->[0][1]</td><td bgcolor=$data{cell_color}><font color=$data{form_color}>$match_ref->[0][4]</font> $colored_list</td>");
  321.                    
  322.                     } else {
  323.                    
  324.                     my ($esa_mss_list) =@$esatta_ref;
  325.                     my $list = stampa_mss(@$esa_mss_list);
  326.                     push (@tab_array, "<tr><td>$esatta_ref->[0][0]</td><td>$esatta_ref->[0][1]</td><td>$esatta_ref->[0][4] $list</td>");
  327.                     $conta++;
  328.                     push (@tab_array, "<td bgcolor=$data{cell_color}><font color=$data{form_color}>$match_ref->[0][4]</font> $colored_list</td>");
  329.                     }
  330.                    
  331.               foreach my $riga2_ref (@$altrirec_ref) {
  332.                    
  333.                     my $list = stampa_mss(@$riga2_ref);
  334.                     push (@tab_array, "<td>$riga2_ref->[4] $list</td>");
  335.                     $conta++;
  336.               }
  337.  
  338.         my $completa_riga = "<td>&nbsp;</td>" x ($max-$conta-1);
  339.         $conta=0;
  340.        
  341.         push (@tab_array, "$completa_riga</tr>\n");
  342.         $data{numero_occ} = scalar (@$pc_id_ref);  
  343.         $data{tab_array} = \@tab_array;
  344.        
  345.         }
  346.     } else {
  347.     no_results();
  348.     }
  349. }
  350.  
  351.  
  352.  
  353.  
  354.  
  355. sub calcola_max_col {
  356.  
  357.        
  358.         my $pc_id_ref = shift;
  359.         my $max=0;
  360.         foreach my $riga_ref (@$pc_id_ref) {
  361.        
  362.                 my $ary_ref  = $data{dbh}->selectrow_arrayref("SELECT count(*) FROM monotab WHERE id_pc =" .$riga_ref->[0]) or die "$DBI::errstr";
  363.                
  364.                 if ($ary_ref->[0] > $max) {
  365.                         $max = $ary_ref->[0];
  366.                 }
  367.                 $data{max} = $max-1;
  368.  
  369.         }
  370.     return $max;   
  371. }
  372.  
  373.  
  374. sub sort_alfanum{
  375.  
  376. my @confused = @_;
  377.  
  378. my @sorted =
  379.     map { $_->[0].$_->[1] }
  380.     sort {  $a->[0] cmp $b->[0] or $a->[1] <=> $b->[1] }
  381.     map { [/(\D*)(\d*)/] }
  382.     @confused;
  383.  
  384. return @sorted;
  385.  
  386.  
  387. }
  388.  
  389.  
  390. sub stampa_mss{
  391.  
  392.     my @values = @_;
  393.     my @manoscr_valori = @values[6..42];
  394.     my %mscr;
  395.     my @list;
  396.     my $joined;
  397.    
  398.     for (my $i=0; $i<36; $i++) {
  399.  
  400.          $mscr{$data{manoscr}->[$i]} = $manoscr_valori[$i] if $manoscr_valori[$i] ne "0";
  401.  
  402.     }
  403.     foreach my $key (sort keys %mscr) {
  404.  
  405.         if    ($mscr{$key} eq "t") {push (@list, $key);}
  406.         elsif ($mscr{$key} eq "m" || $mscr{$key} eq "c") {push (@list, "$key$mscr{$key}");}
  407.     }
  408.  
  409.     @list =sort_alfanum(@list);
  410.    
  411.      my @crit_t = split ( /, /, $data{crit_t});
  412.      my @crit_0 = split ( /, /, $data{crit_0});
  413.      
  414.      my %green_colored = map { $_ => "<b><font color=$data{yes_color}>$_</font></b>" } @crit_t;
  415.      my %red_colored   = map { $_ => "<font color=$data{no_color}>$_</font>" } @crit_0;
  416.                            
  417.      foreach my $list (@list) {
  418.           $list = $green_colored{$list} if exists $green_colored{$list};
  419.           $list = $red_colored{$list}   if exists $red_colored{$list};
  420.      }
  421.  
  422.     $joined =join (', ', @list);
  423.     return $joined;
  424.    
  425. }  
  426.  
  427.  
  428.  
  429.  
  430. sub stampa_gif {
  431.  
  432.     my $query_gif = $data{query_gif};
  433.     my $script=$data{script};
  434.  
  435.     if ($query_gif) {
  436.  
  437.         $script.="?runmode=gif&$query_gif";
  438.         $script=~s/ /%20/g;
  439.  
  440.         print qq[<br><center>
  441.         <img src="$script" alt="istogramma">
  442.         </center>];
  443.     }
  444. }
  445.  
  446.  
  447.  
  448. sub gif {
  449.    
  450.     my @array_data;
  451.     my @array_nomi;
  452.     my @values= @{ $data{manoscr} };
  453.  
  454.     my %hash = map { ;"$_" => scalar(param($_)) } @values;
  455.     my $max_y=0;
  456.     my $val;
  457.  
  458.     $max_y=0;
  459.     my @keys = sort_alfanum(keys %hash);
  460.     foreach my $key (@keys) {
  461.         my $val=$hash{$key};
  462.         $max_y=$val if ($val > $max_y);
  463.         push @array_nomi,$key;
  464.         push @array_data,$val;
  465.     }
  466.            
  467.     my @data;
  468.  
  469.     $data[0]=\@array_nomi;
  470.     $data[1]=\@array_data;
  471.  
  472.     my @dim = (800,600);
  473.     my $my_graph=GD::Graph::bars->new(@dim);
  474.  
  475.     $my_graph->set(
  476.             x_label         => 'Manoscritti',
  477.             y_label         => 'Occorrenze',
  478.             title           => 'Grafico ad istogrammi',
  479.             y_max_value     => $max_y,
  480.             y_tick_number   => 8,
  481.             y_label_skip    => 2,
  482.             bar_spacing     => 2,
  483.             shadow_depth    => 3,
  484.             bargroup_spacing   => 4,
  485.             accent_treshold => 200,
  486.  
  487.             transparent     => 0,
  488.         );
  489.  
  490.       $my_graph->plot(\@data);
  491.       my $ext = $my_graph->export_format;
  492.  
  493.       print "Content-Type: image/gif;\n\n";
  494.       binmode STDOUT;
  495.       print STDOUT $my_graph->gd->$ext();
  496.       close STDOUT;
  497. }
  498.  
  499. ####################################################################
  500. #                                                                  #
  501. #     Le Sub per la costruzione di codice html                     #
  502. #                                                                  #
  503. ####################################################################
  504.  
  505.  
  506. sub tabella{
  507.  
  508. #my $array_ref = shift;
  509. #my @tab_array = @$array_ref;
  510.  
  511. if  ($data{numero_occ}>0) {
  512.  
  513.         my $query=$data{query};
  514.         my $query_commento=$query;
  515.         $query_commento=~s/>/>/g;      
  516.         my $stampaquery =  "<!- $query_commento  ->\n\n";
  517.        
  518.         my $testatab  = qq(
  519.         <table border=1 width=100%>
  520.         <tr>
  521.         <td><b>Luogo</b></td>
  522.         <td><b>Linea</b></td>
  523.         <td><b>Lezione esatta</b></td>
  524.         <td align=center colspan=$data{max}><b>Altre Varianti</b></td>
  525.         </tr>
  526.         );
  527.  
  528.                 print "\n\n$stampaquery\n\n<br><br><br><center><h1>Criterio di ricerca: \"$data{criterio}\"</h1></center> Numero occorrenze: ";
  529.                 print "$data{numero_occ}\n\n$testatab\n";
  530.                
  531.                 foreach my $riga (@{$data{tab_array}}) {
  532.                     print $riga;
  533.                 }
  534.     print "</table>";
  535.     }
  536. }
  537.  
  538.  
  539.  
  540.  
  541. sub start_html {
  542.  
  543.     print "Content-type: text/html\n\n";
  544.     print qq(<html>
  545.         <head>
  546.         <title>tavola</title>
  547.         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  548.         <style type="text/css">
  549.                 body{background-color: #FFE4B5;}
  550.                 { font-family: Verdana, Arial, Helvetica, Trebuchet MS, sans-serif; font-size: 16; color: #000000; text-decoration: none; }
  551.                 table       { font-family: Verdana, Arial, Helvetica, Trebuchet MS, sans-serif; font-size: 11; color: #000000; text-decoration: none; }  
  552.                 a           { color: green; text-decoration: none; }
  553.                 A:active    { color: #A04415; text-decoration: none; }
  554.                 a:hover     { color: red; text-decoration: none; }
  555.                 .grande     {  font-size: 20pt; color:#222333; text-decoration: none; text-align:center;  vertical-align:top; line-height: 10px; }
  556.                 .LightText  {  font-size: 16pt; color: #000000; text-decoration: none; align: justified; line-height: 30px; }
  557.         </style>
  558.     <SCRIPT language="JavaScript">
  559.     <!-- //
  560.     function indifferente () {
  561.  
  562.            for (var counter=1;counter<=36;counter++) {
  563.  
  564.                     document.compara.elements[counter].selectedIndex=0;
  565.             }
  566.     }
  567.  
  568.     function tuttisi () {
  569.  
  570.            for (var counter=1;counter<=36;counter++) {
  571.  
  572.                     document.compara.elements[counter].selectedIndex=1;
  573.             }
  574.     }
  575.  
  576.     function tuttino () {
  577.  
  578.            for (var counter=1;counter<=36;counter++) {
  579.  
  580.                     document.compara.elements[counter].selectedIndex=2;
  581.             }
  582.     }
  583.     // -->
  584.     </SCRIPT>
  585.         </head>
  586.         <body>
  587.         <p><a href=$data{script}>Nuova ricerca</a></p>);
  588. }
  589.  
  590.  
  591. sub end_html {
  592.  
  593.     print q(
  594.         </body>
  595.         </html>);
  596. }
  597.  
  598. sub no_results {
  599. print "<center><h1>Nessuna occorrenza trovata</h1><hr><br><br>Criterio di ricerca: <b>"<i>$data{criterio}</i>"</b></center>\n";
  600. end_html();            
  601. }
  602.  
  603.  
  604. sub body_html {
  605.  
  606.    
  607.     my @values = @{ $data{manoscr} };
  608.     my $l=0;
  609.    
  610.     print qq(
  611.     <table border=1 width=100%>
  612.     <form name="compara" action=$data{script} method=get>
  613.     <input type="hidden" name="runmode" value="compara">
  614.     <tr>
  615.     );
  616.    
  617.     foreach my $value (@values) {
  618.  
  619.         print qq(
  620.         <td><h1>$value</h1>
  621.         <select name="s$value">
  622.         <option value="">indifferente</option>
  623.         <option value="t">SI'</option>
  624.         <option value="0">NO</option>
  625.         </select></td>
  626.         );
  627.  
  628.         $l++;
  629.  
  630.         if ($l % 8 == 0) {print "</tr>\n<tr>"};
  631.     }
  632.  
  633.     for (my $m=$l; $m<40; $m++) {
  634.  
  635.         if ($m % 8 == 0) {print "</tr>\n<tr>"};
  636.         print "<td><br><br><br></td>\n";
  637.     }
  638.    
  639.     print qq(
  640.     </tr><tr>
  641.     <td><br><br></td>
  642.     <td><br><br></td>
  643.     <td><br><br></td>
  644.     <td><br><br></td>
  645.     <td><br><br></td>
  646.     <td>
  647.     <input type="checkbox" name="esatta" value="esa" checked>in lezione esatta<br>
  648.     <input type="checkbox" name="errata" value="err" checked>in lezione errata<br></td>
  649.     <td><input type="submit" value="compara"></td>
  650.     <td><input type="reset" value="Annulla"></td>
  651.     </tr>
  652.     </form>
  653.     <tr>
  654.    
  655.     <td>
  656.     <input type="button" value="tutti si" onClick="tuttisi();">
  657.     </td>
  658.    
  659.     <td>
  660.     <input type="button" value="tutti no" onClick="tuttino();">
  661.     </td>
  662.    
  663.     <td>
  664.     <input type="button" value="tutti indifferente" onClick="indifferente();">
  665.     </td>
  666.    
  667.     <td><br><br></td>
  668.     <td><br><br></td>
  669.     <td><br><br></td>
  670.     <td><br><br></td>
  671.     <td><br><br></td>
  672.     </tr>
  673.     </table>
  674.    
  675.     <br><br>
  676.     <table border=0 width=100%>
  677.    
  678.     <tr>
  679.     <td bgcolor=a98dc3>
  680.     <form name=cerca action=$data{script} method=get>
  681.     <input type="hidden" name="runmode" value="cerca">
  682.     <input type="text" name="cerca">
  683.     <input type=submit value=cerca>    
  684.     <input type="reset" value="Annulla"></form></td>
  685.     <td><br><br></td>
  686.     <td align=right bgcolor=c98d67>
  687.     manoscritto<br>
  688.     <form name=combo action=$data{script} method=get>
  689.     <input type="hidden" name="runmode" value="combo">
  690.     <select name="menu">
  691.     <option value="tutte">tutti</option>);
  692.    
  693.     foreach my $value (@values) {
  694.         print "<option value=\"$value\">$value</option>\n";
  695.     }
  696.    
  697.     print qq(</select></td>
  698.     <td bgcolor=c98d67>
  699.     <input type="radio" name="2o3" value="coppie" checked="checked">Coppie<br>
  700.     <input type="radio" name="2o3" value="terne">Terne
  701.     </td>
  702.     <td bgcolor=c98d67>
  703.     <input type=submit value=Combina></form></td>
  704.     <td><br><br></td>
  705.     </tr>
  706.     <tr>
  707.     </table>
  708.     );
  709. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement