Multiple selection

Results 1 to 2 of 2

Thread: Multiple selection

  1. #1
    Join Date
    Dec 1969

    Default Multiple selection

    Hi, <BR>Does anybody have any idea how to select two items from a category list box and add to the category table in the database?<BR><BR>Thanks in advance.

  2. #2
    Ray Sugel Guest

    Default RE: Multiple selection

    It depends on whether the categories selected are going into the same record or separate records in the categories table. In either case you make the &#060;select&#062; element capable of accepting multiple options by modifying the code like this: &#060;select name="selctname" size="x" multiple&#062; where x is a number greater than 1 (this sets the number of options visable at one time and makes the &#060;select&#062; a list instead of a menu). When multiple items are selected the &#060;select&#062; returns a comma-delimited value string. If the value from the &#060;select&#062; is going into a single record, assign the Request("selectname") value to a variable and stuff it into the table (either via SQL Insert Into or Update statements or the recordset.AddNew/recordset.Update methods). If they have to go into separate records, it&#039s a bit more tricky. Because the &#060;select&#062; returns a comma-delimited string as a value, you have to break this value up. Use the Split() function to break the string into separate values. The Split(Request("selectname"), ",") places the values into a single dimension array which can then be looped through assigning each dimension to a variable which can then be stuffed into the table.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts