Page 1 of 1

How to submit multiple values using a listbox

Posted: Fri Mar 04, 2005 11:10 pm
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]

Posted: Fri Mar 04, 2005 11:14 pm
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.

Posted: Fri Mar 04, 2005 11:36 pm
by dennis_doug
Thanks for that not sure how it will help as it's all about Java. But i'll give it ago.

Posted: Fri Mar 04, 2005 11:37 pm
by feyd
it's the concept information.. about relational architecture that is important to take away from it.

Posted: Sat Mar 05, 2005 1:30 am
by dennis_doug
ok thank you sensei :wink: