Re: Dynamically populating a dropdown box

From: Date: Fri, 14 Dec 2001 20:07:08 +0000
Subject: Re: Dynamically populating a dropdown box
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-15041@lists.php.net to get a copy of this message
Chris - You're getting already getting plenty of answers to this question - I only have one suggestion, which is that if you're not doing it already, just write a function or create an object that makes a dropdown box. I have a function and a class that I use for creating dropdowns. Well, several functions... one that queries a db with db, table, id field, label field, etc. and produces a dropdown with options having one value and labels having another, one that accepts an array or a 2-dimensional array, and one that accepts a numeric range as arguments etc. etc. It will save you a ton of time... (rather than intruding into your html form with a long php statement, why not just call: <? select_array("name", $array); ?>). cheers, db Chris Payne wrote: > Hi there everyone, > > I have a shopping cart which is starting to work nicely, but I have to select size/color from > the entries, how do I do this dynamically in PHP with MySQL? I need them to be dropdown form boxes > but haven't got a clue how to populate them from the fields of my database. > > Please help me with example code if possible, it would be greatly appreciated :-) > > Thank you everyone > > Regards > > Chris -- ---------- Dan Barton Terrestrial Program Biologist Asst. Data Manager Point Reyes Bird Observatory http://www.prbo.org dbarton@prbo.org dbarton@grayflycatcher.org

« previous php.db (#15041) next »