1

I am working on classic Asp, I want to send the value selected in drop down to another form through query string. I tried as below:

<FORM method="POST" action="Includes/bfl_forms.asp?type=S&id="&rsStates("UID")>

and like this but didn't work out

<FORM method="POST" action="Includes/bfl_forms.asp?type=S&id="&dest.options[dest.selectedIndex].value>

but the way I am populating drop down by as below :

private sub generateStateDropDownList()`
    temp = ""`
    temp = temp + "<SELECT NAME=""dest"">"   `
    temp = temp + "<option value=""#"">Select a State"`
    rsStates.MoveFirst`
    Do While NOT rsStates.EOF`
        temp = temp + "</SELECT>"'`

I am unable to pass the drop down value to new form. Please assist me. Thanks in advance.

Paul
  • 3,962
  • 2
  • 23
  • 49
Rajasekhar
  • 23
  • 1
  • 8

2 Answers2

1

You appear to have formatted your form tags incorrectly. You should be doing something like this:

<form method="post" action="includes/bgl_forms.asp?type=S&id=<%= rsStates("UID") %>">

or...

<form method="post" action="includes/bgl_forms.asp?type=S&id=<%= Request.Form("dest") %>">

The code to populate your select tag, though, is a bit all over the place. Firstly, it's more efficient to write your output directly to the buffer, like so:

Response.Write("<select....")

Rather than building up a string like that.

Secondly, you only need to supply the option list of the select tag, like so...

<select id="dest" name="dest">
    <% BuildOptions rsStates(destId) %>
</select>

The BuildOptions function in the middle would be used to populate the options from your look-up list.

Speed is always of the essence with CLassic ASP. I recommend that you use something like GetRows of the ADO RecordSet object.

Paul
  • 3,962
  • 2
  • 23
  • 49
1

How about using GET instead of POST?

<form method="GET" action="includes/bgl_forms.asp">

That will put all the inputs into the querystring,

Rocky
  • 476
  • 6
  • 18
  • The `GET` and `POST` methods both have their distinct advantages, but their usage should be [carefully considered](http://stackoverflow.com/questions/3477333/what-is-the-difference-between-post-and-get). – Paul Oct 06 '14 at 07:45