Re: [PHP-DB] Dynamically populating a dropdown box

2001-12-14 Thread Daniel Barton

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
[EMAIL PROTECTED]
[EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] Dynamically populating a dropdown box

2001-12-13 Thread Chris Payne

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