Change <SELECT name=rapped> to <SELECT name=rapped size=1> Sascha
Am Donnerstag, 19. September 2002 03:34 schrieb Andre Dubuc: > I'm trying to generate a dropdown SELECT list from a database query. So > far, all I've managed to create is multiple one-item dropdowns for each > database entry spread across the page. Bad -- very bad! > > I'd like normal drop-down SELECT behavior, but somehow the code escapes me. > I've tried a bunch of permutations, but I either end up with an empty > dropdown or multiple single entry messes. > > Is there anyway to iterate through this and achieve what I want? > > I would greatly appreciate any hints what I'm missing here or doing wrong. > Code follows. > Tia, > Andre > > > Code (using PostgreSQL): > > > <?php > . . . > $query = "SELECT * FROM rap WHERE rsponsor = '{$_SESSION['sid']}'"; > $result = pg_exec($db, $query); > if (!$result) {exit;} > $numrows = pg_numrows($result); > > if ($numrows == 0) {echo "<h2>Sorry!<br><br>'{$_POST['sid']}' is not in the > our database.<br><br> Click 'Back' on > your browser to enter another search.<br><br></h2>"; exit;} > > $row = 0; > do > { > $myrow = pg_fetch_array($result,$row); > if ($myrow['rupload'] != "") > { > > print "<SELECT name=rapped><option>{$myrow['rfname']} > {$myrow['rsname']}</select>"; > > } > > $row++; > } > while ($row < $numrows); > pg_close($db); > ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php