Re: Dynamically generate a drop down list

From: Date: Mon, 28 Jul 2003 11:12:41 +0000
Subject: Re: Dynamically generate a drop down list
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-157162@lists.php.net to get a copy of this message
> Is it possible to have a function which echoes the values as they are > read from the database? something like.... function init_auth_list() { print "<select name=author> <option value=\"\">select the name of the author</option\>"; $query="select name from author order by name"; $result=pg_exec($GLOBALS["db"],$query); $numrows=pg_numrows($result); $i=0; while($i<$numrows) { $row=pg_fetch_row($result,$i); print "option name=\"".$row[0]."\">$row[0]</option>"; $i++; } print "</select>"; } > > I tried doing something of this sort..but didn't work.. > Any suggestions? > Thanks in advance, > Mukta > hope it works, this is just from the top of my head... -skate-

« previous php.general (#157162) next »