pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Wilson Fletcher <wilson@mclachlan.com.au>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: RE: Loading values in from postgreSQL database into a combo box using PHP
Date: Fri, 31 Mar 2000 15:16:29 +1000
Message-ID: <01BF9B24.1AC04780.wilson@mclachlan.com.au> (raw)

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





Message-ID: <01BF9B24.1AC04780.wilson@mclachlan.com.au>
Permalink:  ../01BF9B24.1AC04780.wilson@mclachlan.com.au/
Also on:    postgresql.org/message-id/01BF9B24.1AC04780.wilson@mclachlan.com.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: wilson@mclachlan.com.au
  Subject: Re: Loading values in from postgreSQL database into a combo box using PHP
  In-Reply-To: <01BF9B24.1AC04780.wilson@mclachlan.com.au>
  References: <01BF9B24.1AC04780.wilson@mclachlan.com.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox