in reply to Re: Drop Down Selection From Database
in thread Drop Down Selection From Database

something like this: not completely correct i think...

use CGI;
use DBI;
use strict;

my $q = new CGI;
print $q->header();

print "<html><form><select>\n";

my $dbh = DBI->connect(&DSN, &USER, &PASS);

my $sth  = $dbh->prepare("SELECT memberID, membername FROM members");

$sth->execute();

while( my ($memberID, $membername) = $sth->fetchrow_array() ) {
   print "<option value="$memberID">$membername \n";
}


  • Comment on Re: Re: Drop Down Selection From Database

Replies are listed 'Best First'.
Re: Re: Re: Drop Down Selection From Database
by Anonymous Monk on Jan 26, 2001 at 20:40 UTC
    it erased my formating... the first time.. something like this: not completely correct i think...
    
    use CGI;
    use DBI;
    use strict;
    
    my $q = new CGI;
    print $q->header();
    
    print "<html><form><select>\n";
    
    my $dbh = DBI->connect(&DSN, &USER, &PASS);
    
    my $sth  = $dbh->prepare("SELECT memberID, membername FROM members");
    
    $sth->execute();
    
    while( my ($memberID, $membername) = $sth->fetchrow_array() ) {
       print "<option value="$memberID">$membername \n";
    }