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:[EMAIL PROTECTED]
http://accessingram.com


> -----Original Message-----
> From: Hull, Douglas D [mailto:[EMAIL PROTECTED]
> 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
> 

Reply via email to