|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Select list from array in database
Hi, I know I'm really close but the answer is eluding me at this time. I have a database with a table as such:
id|category|description|price|size_set|image|color _set The "size_set" and "color_set" both contains arrays which determine the sizes and colors available for that item. What I have so far for code is this: echo "<select name='color'>"; $records = explode(',', $colors); for ( $i = '1'; $i <= count( $records ); $i++ ) { echo "<option value=\"$records\">$records</option>"; } echo "</select>"; But the results give me a drop down that just has the word array in it for each array item. What am I missing? The actual page showing the results can be found at URL |
|
#2
|
|||
|
|||
|
Change ->
PHP Code:
To -> PHP Code:
__________________
~ Joe Penn We work for free to help make this a valuable resource on the internet. Do you appreciate the help - did we provide help that will help you prosper and help that has contributed to sharpening your current skill set? Show your appreciation and purchase something from our Amazon Wishlist's - it's simple and a great way to say thank you. |
|
#3
|
|||
|
|||
|
select from an array
Thank you! That got me a lot closer. The only thing is now the drop down box does have the choices, but there are empty lines between each choice in the drop down box. When you click on it to display the choices they show up like this:
1 2 3 rather than: 1 2 3 |
|
#4
|
|||
|
|||
|
PHP Code:
|
|
#5
|
|||
|
|||
|
Still not trimming
I added the code you gave and it still didn't take out the empty lines in the select box. Any other suggestions? It's so close!
CJ Lewin Added on at 6:28pm Never mind! Found the problem causing the extra spaces. There was a <option> tag at the end rather than an </option> tag. It works great now! Thanks to both of you! CJ Lewin Last edited by clewin : February 4th, 2003 at 05:27 PM. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Database Development > Select list from array in database |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|