Re: Creating Dropdown Menus From Tables

From: Date: Mon, 20 Sep 2004 13:00:58 +0000
Subject: Re: Creating Dropdown Menus From Tables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-197271@lists.php.net to get a copy of this message
Living in the past? Harlequin wrote:
Hi all. Hoping this might be relatively easy... I'm wondering if I can create a dropdown menu (<option>ABCDE</option>) by using a select statement and then populating this using PHP...?
Yes, it is relatively easy, and it is answered in virtualy every PHP book. I recomend you get one. Some (pseudo) code: $res = query(select id, name from table); while($row = get_result($res)) { echo "<option value='$row[id]'>$row[name]</option>"; }

« previous php.general (#197271) next »