Form and Variables Question

Results 1 to 3 of 3

Thread: Form and Variables Question

  1. #1
    janix Guest

    Default Form and Variables Question

    Hey all,<BR> I have a form like the one below on my website.<BR><BR>&#060;select name=names size=20 multiple&#062;<BR>&#060;option value=foo&#062;foo<BR>&#060;option value=bar&#062;bar<BR>PLUS MANY, MANY MORE VALUE.<BR>&#060;/option&#062;<BR><BR>Now, basically, since I have allowed the user to select MULTIPLE value before they submit the form, I want to know how to get each one of those values into a different variable once it is submitted. Problem is, the name of the form is &#039names&#039 Therefore, every value the user selected is put into the Request("names") variable. How can I get all of the different values that the user selects into a different variable in ASP is my question. Thank you so much for your time.<BR><BR>Shaun<BR>

  2. #2
    Sateesh Guest

    Default RE: Form and Variables Question

    when you submitt the form the html joins all the values selected seperated by a comma and passes it to the other page, you can very well use the split function to seperate the joined values.

  3. #3
    Join Date
    Dec 1969

    Default RE: Form and Variables Question

    Trust me, you don&#039t WANT them in "different variables". Trying to write code using different variable names, when you don&#039t know how many such names you need...shudder.<BR><BR>Better to use an ARRAY. And VBS makes that easy:<BR><BR>&#060;%<BR>choices = Split( Request.Form("multiSelect"), ", " ) &#039 that is COMMA-SPACE<BR>For i = 0 To UBound( choices )<BR>&nbsp; &nbsp; Response.Write "choice number " & i & " was " & choices(i)<BR>&nbsp; &nbsp; ...<BR>Next<BR>%&#062;<BR><BR>If you don&#039t understand arrays, then time to go back to your VBScript books and learn about them!<BR><BR>

Posting Permissions

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