Multiple Section List

Results 1 to 2 of 2

Thread: Multiple Section List

  1. #1
    Bobby Guest

    Default Multiple Section List

    I have a form which contains a select field that can have multiple selections. For instance, I have a select field and the options are "California, Arkansas, Washington, Nevada" Now, the user can select one or more than one option. The option(s) he selects will be used as the querying variable in my SQL stmnt. "SELECT * FROM customers WHERE state = &#039"&Request("state")&"&#039. This works fine if he chooses just one option, but how do I configure this if he chooses more than one option???<BR><BR>PLEASE HELP!!<BR><BR>Thanks

  2. #2
    Nathen Grass Guest

    Default RE: Multiple Section List

    Multiple selections like what you&#039re talking about come back in a comma-delimited string. So if a user selects Georgia and Florida then Request("State") = "Georgia,Florida".<BR><BR>To get around this just use the split function to separate the string into an array and use a For..Next loop to create your WHERE clause.<BR><BR>i.e.<BR><BR>strStates = split(Request.Form("States"),",")<BR><BR>For x = 0 to UBound(strStates)<BR><BR>&nbsp;&nbsp;&nbsp;&#039Cr eate WHERE clause here<BR><BR>Next

Posting Permissions

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