I did it this way:
<?php $conn = pg_connect("", "", "", "", "webdb"); $result = pg_exec( $conn, " select fname || ' '
|| mnames || ' ' || sname as name
from authors" ); $count = 0; $numrows = pg_numrows( $result ); while ( $count < $numrows ):
$row = pg_fetch_object ($result, $count); $list[$count] = "<OPTION>".$row->name; $count++;
endwhile; $items = implode( $list, "\n"); pg_close( $conn ); echo "<b>Author :</b> <select
name=author>"; echo "<OPTION SELECTED>".$items."</select><p>\n"; ?>
Wilson Fletcher
----------
From: Jay[SMTP:jmac@nemesis.com.au]
Sent: Wednesday, 29 March 2000 22:28
To: pgsql-sql@postgresql.org
Subject: [SQL] Loading values in from postgreSQL database into a combo box using PHP
I am trying to find the script commands (in a .php3 file) for reading, say,
all the surnames from an Address Book table and load them into a combo (or
drop-down) box so that the user can choose one and then click on submit
button for some other purpose.
Can someone give me an example of how this is done?
JM