Question : Need a simple example please

Need an example showing how to pull items in a file into a script and show all the fields in a combobox

Answer : Need a simple example please

Maneshr is correct, the key is getting the things from the file.  One example might be a comma seperated file with key/value in the file (key being an ID, value being a name)



Here's something really basic.  Now my CGI.pm syntax might be slightly off,
im doing other stuff these days, and if you dont like CGI.pm use your own methods
or out HTML by hand


etc...

anyway something to go with.

FILE:

1, Matthew Mac Gibbon
2, Jason Weinburg

etc...


---
PERL:

#!/usr/bin/perl

use CGI qw(:all);  
  # Lets use CGI if you have it, otherwise ignore the second half
  # and output HTML directly

my %info = ();
my @box = ();
open IN, "FILE";
while () {
   chomp;
   my ($k, $v) = split ', ';
   $info{$v} = $k;
   push @box, $v;
}


### A popup, Lets say we're using CGI.pm



my $box =
    checkbox_group(-name=>'boxname', -values=>\@box, -values=>\%info);


### Basic form ####

print header, start_form, $box, br, submit(), end_form;

#####

 

   
Random Solutions  
 
programming4us programming4us