Re: SELECT box
| From: | Ignacio Vazquez-Abrams | Date: | Mon, 11 Dec 2000 23:27:20 +0000 |
| Subject: | Re: SELECT box | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29766@lists.php.net to get a copy of this message | ||
On Tue, 12 Dec 2000, Robert Ludvik wrote:
> hi
> i create a dinamic select box from DB with this piece of code
> ...
> for ($i=0; $i<$num; $i++) {
> $r = pg_fetch_row($result, $i);
> $vrstica='';
> for ($j=0; $j<(count($r)-1); $j++) {
> $vrstica = $vrstica . $r[$j];
> }
> $data1=substr($vrstica,0,3);
> echo("<OPTION VALUE=$data1>$vrstica");
> ...
> with this i try to get some usefull value from selection for further work but
> from minute to minute it seems more fun to me :)
> any tip?
> thnx
>
You should have a "key" value in the table (ideally an autoincrement field, or
at least unique) that has the selection value. Then you display the
description in between <option ...>...</option>.
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>