Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] echo > dropdown



On Thu, 10 Feb 2005, Ahmed Sarwar wrote:

> Hello, can someone please tell me how to put the following "echo" to
> the "dropdown list".
>
> pg_connect("dbname=address host=localhost") or die("Couldn't Connect");
> $query = "SELECT * FROM address";
> $query = pg_query($query);
> while($row = pg_fetch_array($query,NULL,PGSQL_ASSOC))
> {
>  echo "Name: ".$row['name']."<br />";
> }

echo "<select name=\"address\">\n";
while($row = pg_fetch_array($query,NULL,PGSQL_ASSOC)) {
   echo "<option value=\"$row['key']\">$row['name']\n";
}
echo "</select>

Basically you just output HTML.
-- 
Tod McQuillin


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links