Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submitted Dropdown Lists Handled as Lists or Arrays? 1

Status
Not open for further replies.

ChefSausage

Programmer
Oct 19, 2002
36
US
How does ASP handle listbox values when passed through a submitted form? Does it create an array or list of the values. I'm going on the fact of my dropdown allowing multiple selections. How would the syntax for it look, too?
 
It passes them as a comma delimited string. Actually, in reality, it is comma-space delimited. The easiest way to handle this is to split them into an array on that comma-space delimiter:
Code:
Example Form:
<form method=&quot;POST&quot; action=&quot;myPage.asp&quot;>
<select name=&quot;selColors&quot; multiple>
   <option>Blue</option>
   <option>Red</option>
   <option>Green</option>
   <option>Yeller</option>
</select>
<input type=&quot;submit&quot;>
</form>

Example Processing:
Dim colors, i
colors = Split(Request.Form(&quot;selColors&quot;),&quot;, &quot;)
For i = 0 to UBound(colors)
   Response.Write colors(i) & &quot;<br>&quot;
Next

I only included the form to make the processing make more sense, I was pretty sure you had that part handled already :)

-Tarwn

01010100 01101001 01100101 01110010 01101110 01101111 01101011 00101110 01100011 01101111 01101101
29 3K 10 3D 3L 3J 3K 10 32 35 10 3E 39 33 35 10 3K 3F 10 38 31 3M 35 10 36 3I 35 35 10 3K 39 3D 35 10 1Q 19
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top