Posting a selected option (drop down list)

S

Serge Myrand

Hi,

I cannot get the selected option to be POSTed (it does not appear in the
QueryString when using GET neither)

I construct the drop down list from an array, I select an element in the
list, I POST using a submit button. When I use Request.Form("NAME") it's
always empty. Is the selected item is Posted? How to retreive it?


Response.Write "<SELECT NAME>"
for i = LBound(aRessource, 1) to UBound(aRessource, 1)
Response.Write "<OPTION VALUE=" & i & ">"
Response.Write aRessource(i, 0)
next
Response.Write "<OPTION SELECTED>"
Response.Write "</SELECT>"


thank you for your time
serge
 
B

Bob Barrows [MVP]

Serge said:
Hi,

I cannot get the selected option to be POSTed (it does not appear in
the QueryString when using GET neither)

I construct the drop down list from an array, I select an element in
the list, I POST using a submit button. When I use
Request.Form("NAME") it's always empty. Is the selected item is
Posted? How to retreive it?


Response.Write "<SELECT NAME>"
for i = LBound(aRessource, 1) to UBound(aRessource, 1)
Response.Write "<OPTION VALUE=" & i & ">"
Response.Write aRessource(i, 0)
next
Response.Write "<OPTION SELECTED>"
Response.Write "</SELECT>"


thank you for your time
serge


1. Do not use reserved words for object or variable names. "NAME" is a word
that should definitely be avoided: it is used everywhere!
2. You did not assign a name to the SELECT's name attribute. It should be
like this:

Response.Write "<SELECT name=""lstRessource"">"


In the other page, you would do this:

Request.Form("lstRessource")

Bob Barrows
 
S

Serge Myrand

Thank's

serge


Bob Barrows said:
1. Do not use reserved words for object or variable names. "NAME" is a word
that should definitely be avoided: it is used everywhere!
2. You did not assign a name to the SELECT's name attribute. It should be
like this:

Response.Write "<SELECT name=""lstRessource"">"

In the other page, you would do this:

Request.Form("lstRessource")

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top