Howdy:

Just wanted to say thanks and post what I 
finally came up with in the code (for the first
part of what I'm trying to do, anyways ...)

Will have to edit; I'm not even using the start_form
sub query ... figured this was as 'bare bones' as I
could make it.

(*special thanks to elaine a., brent m and david k;
your code gave me a lot to mull over and study)

-X


[begin code]

!/usr/bin/perl -w

$debug=2;

# works (part one anyway)
# 5 Apr 02
#

use Pg;
use CGI qw(:standard);
use CGI::Carp 'fatalsToBrowser';
require "/var/www/hminclude.pl";

$conn=bcnOpen();

#---------------------------------------------------------------------------
---
# Below is the standard input-getter thingy, which will grab the input
regardless
# of whether it's "get" or "post," and will save it to $in.
# Probably don't really need this ...
#---------------------------------------------------------------------------
---


my $in;
if ($ENV{'REQUEST_METHOD'} eq "GET") {
        $in = $ENV{'QUERY_STRING'};
} else {
        $in = <STDIN>;
}

#
#
# describe title / header
#

my $TITLE='HMP Table List - (test)';

print header,
        start_html(-title=>"Get Table List", -bgcolor=>'white');
if (!param() ) {
        start_form();
} else {
        print "$!";
}

print end_html;

#
# base of the query - this is where the results of
# the query is rolled up into a variable called $result
#

my $result=doquery('get table',
        qq! select relname from pg_class
        where relname not like 'pg\\_%'
        and relkind = 'r' order by 1!);


# create the web page
# in here i make the header and make sure
# the list of tables are NOT in the while loop
#

print <<EOF;
Content-Type: text/html\n\n

<html>
<body bgcolor="white" text="black">
<center><h2>Postgres Tables</h2></center><p>
<center><hr size=1 width=50%></center>
<select name="List">
EOF

#
# the loop and print the HTML code
# for a non-input form field (select)
#

while (my ($relname)=$result->fetchrow) {
print <<END;
<option>$relname</option>
END
}

# end the HTML code outside of the loop
#
print qq!</select>!;

[/end of code]

Reply via email to