Return-Path: <php-db-return-30795-robert=seabreeze.asn.au@lists.php.net>
Envelope-To: robert@seabreeze.asn.au
X-Spam-Status: SpamAssassin Failed
Received: from pb1.pair.com ([216.92.131.4] verified)
  by hermajestystheatre.com.au (CommuniGate Pro SMTP 4.1.3)
  with SMTP id 356996 for robert@seabreeze.asn.au; Thu, 02 Oct 2003 06:09:29 +1000
Received: (qmail 78649 invoked by uid 1010); 1 Oct 2003 20:21:04 -0000
Mailing-List: contact php-db-help@lists.php.net; run by ezmlm
Precedence: bulk
list-help: <mailto:php-db-help@lists.php.net>
list-unsubscribe: <mailto:php-db-unsubscribe@lists.php.net>
list-post: <mailto:php-db@lists.php.net>
Delivered-To: mailing list php-db@lists.php.net
Received: (qmail 78617 invoked by uid 1010); 1 Oct 2003 20:21:04 -0000
Delivered-To: ezmlm-scan-php-db@lists.php.net
Delivered-To: ezmlm-php-db@lists.php.net
Message-ID: <309419457839D4119E0D00508B6DFE0B1204C6A5@lavergne.iei.nexus>
From: Gary.Every@ingramentertainment.com
To: ddhull@ku.edu, php-db@lists.php.net
Date: Wed, 1 Oct 2003 15:20:51 -0500 
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C38859.820999C0"
Subject: RE: [PHP-DB] show list of values and new values

------_=_NextPart_001_01C38859.820999C0
Content-Type: text/plain;
	charset="iso-8859-1"

Create a table (items) with selectable items with these columns

select_id 	| selection | description
------------+-----------+------------
1		| #000000	| White
1		| #FFFFFF	| Black
2		| other	| Another type
2		| second	| Second Type


use "select * from items where select_id='1';
into a variable, say $colors

then
<?php
echo "<select name=color>";
foreach($colors as $color) {
  $selection = $color['selection'];
  $description = $color['description'];
    echo "<option value=\"$selection\">$description</option>";
}
echo "</select>";

/* That will build a dropdown with the available colors (select_id='1')
*/
<form>
Then build an <input type=text> 3 times to do an add to the db, with
select_id,selection, and description. That will add a row to the table, and
each time you run the script above, it will be populated with all the rows
that have select_id='1'. You can use the same table with different
select_id's for different dropdowns.



Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
"Pay It Forward"
mailto:gary.every@ingramentertainment.com
http://accessingram.com


> -----Original Message-----
> From: Hull, Douglas D [mailto:ddhull@ku.edu]
> Sent: Wednesday, October 01, 2003 2:52 PM
> To: Note To php mysql List (E-mail)
> Subject: [PHP-DB] show list of values and new values
> 
> 
> Just for example, in php how can I show a list of colors so 
> the user can
> select one?  Also if needed the user could add a new color.  
> This could be a
> drop down or whatever.
> 
> How can I make this dynamic so when the user adds the new color that
> anywhere I show the list of colors in my web pages the new 
> color would be
> available for selection for this user and all users following?
> 
> Kind of confusing, let me know if you need more detail.
> 
> Thanks,
> Doug.  
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

------_=_NextPart_001_01C38859.820999C0--
