How to submit multiple values using a listbox

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dennis_doug
Forum Newbie
Posts: 5
Joined: Fri Mar 04, 2005 10:56 pm

How to submit multiple values using a listbox

Post by dennis_doug »

Can any one tell me how to submit multiple values from a list box? I believe it has something to do with Arrays or Loops but i'm not sure.

this is this list box code. As you can see it is populated by the products database.

Could somebody show me what the array loop thing is supposed to look like. So this list box submits multiple values. At the moment when you submit the form all that is entered into the database is the word Array not the values of the list box. Do I need to change the setting in the mySQL datbase. At the moment the field it is entered into is Text.

Code: Select all

<select name="vehicle_typeї]" size="20" multiple>
<?php do { ?>
<option value="<?php echo $row_rsProductsї'vehicle_type']?>" ><?php echo $row_rsProductsї'vehicle_type']?></option>
<?php } while ($row_rsProducts = mysql_fetch_assoc($rsProducts)); ?></select>
much appreciated

Thank you :0)


feyd | please use

Code: Select all

tags while the

Code: Select all

tags are offline[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

look into for(), foreach(), and while().

you may also play with implode() if need be.. although I'd suggest storing the selections individually, as this allows for more flexibility and such..

http://www.oreilly.com/catalog/javadtab ... r/ch02.pdf may be of great help in explaining my suggestion.
dennis_doug
Forum Newbie
Posts: 5
Joined: Fri Mar 04, 2005 10:56 pm

Post by dennis_doug »

Thanks for that not sure how it will help as it's all about Java. But i'll give it ago.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it's the concept information.. about relational architecture that is important to take away from it.
dennis_doug
Forum Newbie
Posts: 5
Joined: Fri Mar 04, 2005 10:56 pm

Post by dennis_doug »

ok thank you sensei :wink:
Post Reply