... or die "Couldn't execute query: ".$dbh->errstr;
####
$statement = "SELECT city FROM database WHERE state='$FORM{state}'";
####
$statement = "SELECT city FROM database WHERE state=?";
$sth = $dbh->prepare($statement) or die "Couldn't prepare the query: ".$sth->errstr;
$rv = $sth->execute($FORM{state}) or die "Couldn't execute query: ".$dbh->errstr;
####
# inside the html
foreach my $row ($sth->fetchall_arrayref) {
my $state = $row->[0];
print "... some html or other based on $state...";
}
####
------------
:Wq
Not an editor command: Wq