Thanks. Here is what I did for future reference. <select name = "departments"> <option value = ''> -- Select a Department -- </option> <? $connection = mysql_connect( "127.0.0.1", "username", "password") or die ("Could not connect");
$db = mysql_select_db ("asset") or die ("Could not connect"); $sql = "select department_name from Departments"; $sql_result = mysql_query($sql,$connection) or die ("Could not connect"); while($row = mysql_fetch_array($sql_result)) { $department = $row["department_name"]; echo "<option value = '$department'>$department</option>"; } ?> </select> > From: Erik Price <[EMAIL PROTECTED]> > Date: Mon, 1 Jul 2002 09:18:12 -0400 > To: Mike Tuller <[EMAIL PROTECTED]> > Cc: php mailing list <[EMAIL PROTECTED]> > Subject: Re: [PHP] Populate Popup Menu from Database > > > On Saturday, June 29, 2002, at 11:41 AM, Mike Tuller wrote: > >> What is here is beyond my understanding, and seems like it is a little >> much >> for what I need. >> >> Here is what my database table looks like: >> >> Departments >> department_id >> department_name >> >> I just want to list the department name in the popup. > > although I wrote this instruction in response to a question about > integrating the listbox with javaScript, ignore the JS stuff, and you > will see how to dynamically populate a listbox with database data: > > http://marc.theaimsgroup.com/?l=php-general&m=102503848224300&w=2 > > > > ---- > > Erik Price > Web Developer Temp > Media Lab, H.H. Brown > [EMAIL PROTECTED] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php