Re: Populate Popup Menu from Database

From: Date: Sat, 29 Jun 2002 16:33:45 +0000
Subject: Re: Populate Popup Menu from Database
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-104500@lists.php.net to get a copy of this message
Thanks. I thought the example I found was a little to complicated for something like this. > From: "Cal Evans" <cal@calevans.com> > Date: Sat, 29 Jun 2002 11:03:16 -0500 > To: "Mike Tuller" <php@ce.anoka.k12.mn.us>, "php mailing list" > <php-general@lists.php.net> > Subject: RE: [PHP] Populate Popup Menu from Database > > Hi Mike, > > Check out ADODB. It's a database abstraction layer for PHP that has > functions to do this. (php.weblogs.com) Otherwise it's kinda easy to do > this, here's some psuedo-code that shoudl get you going. > > <?PHP > // Make your connection to your database > // Select * from department > ?> > <SELECT name='departmentID'> > <?PHP > //While !EOF > ?> > <?PHP > <option value="<PHP echo $rs->fields['departmentID']; > ?>"><PHP echo > $rs->fields['departmentName']; ?> > ?> > <?PHP > // loop > ?> > </SELECT> > > =C= > > * > * Cal Evans > * Journeyman Programmer > * Techno-Mage > * http://www.calevans.com > * > > > -----Original Message----- > From: Mike Tuller [mailto:php@ce.anoka.k12.mn.us] > Sent: Saturday, June 29, 2002 10:42 AM > To: php mailing list > Subject: [PHP] Populate Popup Menu from Database > > > I have some popup menus and want the items in the menu to be populated from > a database. In this case I have a table that contains a listing of > departments. I have a page that I can go in and add/delete departments, and > want the changes to reflect in the menu the next time you go to the page. > > I searched for examples and found this: > > > http://marc.theaimsgroup.com/?l=php-general&m=97628169623096&w=2 > > 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. > > > Thanks, > Mike > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#104500) next »