Welcome! Log In Create A New Profile

Advanced

Storing multi-selection List Box in MySQL

Posted by kewpe20 
kewpe20
Storing multi-selection List Box in MySQL
December 03, 2008 07:10PM
I have a online Webdev 12 form where I want to allow the user to select a 1 or more options from a Multi-Selection List Box and store those selections in a MySql Table.

For example:
Please Select 1 or more options from the list:
A
B
C
D
E

The problem is that only the 1st option selected is stored in the DB.
If the user selects A, D, and E...only A is stored in the DB.

I also want the user to have the ability to go back into the form to edit selections.
So if they intially selected A, D, and E...I would like A, D, and E to be highlighted when they go back into the form in Edit mode.

Is this possible?

As I'm writing this I'm wondering if I could use a Looper Control to display all the options with a check box next to it like so:
[ ] A
[ ] B
[ ] C
[ ] D

...The user could then check and uncheck the options they want, with the checked options being stored in the DB. When they re-enter the form the options they initially selected will be checked.

Am I making this to complicated?
Is there an easier way to do this that I'm not seeing?
Glenn Rathke
Re: Storing multi-selection List Box in MySQL
December 04, 2008 02:28PM
Hi,

Check out the ListSelect syntax. You can loop thorugh and find outr which ones are highlighted. Unfortunately this does not appear to work in a WebDev combo but nly a list box.

If you need to redisplay them for selecting again, you'll have to kind of reverse engineer your code to select the rows instead of finding which row are highlighted.

A looper makes sense too, in that you can add a checkbox to select records.

HTH
Glenn Rathke
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: