Skip to main content
Inspiring
June 19, 2006
Question

pass drop down value to url

  • June 19, 2006
  • 5 replies
  • 409 views
Hi,
I have a dynamically created drop down box. I want to pass the selected value in the box to the URL, I'm stumped how to do this ? should I use js or can I do it without. I have the box in a form with a button. code below:

<code>

<form id="form1" name="form1" method="post" action="mainPage.asp">
<label for="select"></label>
<select name="select" id="select">
<%
While (NOT rsCategory.EOF)
%>
<option value="<%=(rsCategory.Fields.Item("category_id").Value)%>"><%=(rsCategory.Fields.Item("category_name").Value)%></option>
<%
rsCategory.MoveNext()
Wend
If (rsCategory.CursorType > 0) Then
rsCategory.MoveFirst
Else
rsCategory.Requery
End If
%>
</select>
</p>

<label for="Submit"></label>
<input type="submit" name="Submit" value="Display Products in this Category" id="Submit" />
</form>

</code>

I just want to ass the drop down/select value to the URL and post back to the same page for a recordset to collect the value and display the specified results.

Appreciate any feedback.
This topic is closed to new replies. Start a new post to keep the conversation going.

5 replies

Participating Frequently
June 19, 2006
What scripting language are we talking?
jsltdAuthor
Inspiring
June 19, 2006
asp vb

thanks.
Participating Frequently
June 19, 2006
If you want it in the URL on submit, you need to use method="GET " in your form tag. That is the easiest way.

Why does it need to be in the URL though?
jsltdAuthor
Inspiring
June 19, 2006
thanks for the response. what would be your recommended method to acheive this if not using querystring ?
cheers.
Inspiring
June 19, 2006
> I just want to ass the drop down/select value to the URL and post back to
> the
> same page for a recordset to collect the value and display the specified
> results.
>

I assume you mean "...Pass the drop..."!

The form is submitting to mainPage.asp - so it is getting ALL the values
from the form, and can parse out the <select> choice with -

Request.Form("select")

Is that what you mean?


--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"jsltd" <webforumsuser@macromedia.com> wrote in message
news:e75t45$agi$1@forums.macromedia.com...
> Hi,
> I have a dynamically created drop down box. I want to pass the selected
> value
> in the box to the URL, I'm stumped how to do this ? should I use js or can
> I do
> it without. I have the box in a form with a button. code below:
>
> <code>
>
> <form id="form1" name="form1" method="post" action="mainPage.asp">
> <label for="select"></label>
> <select name="select" id="select">
> <%
> While (NOT rsCategory.EOF)
> %>
> <option
> value="<%=(rsCategory.Fields.Item("category_id").Value)%>"><%=(rsCategory.Fields
> .Item("category_name").Value)%></option>
> <%
> rsCategory.MoveNext()
> Wend
> If (rsCategory.CursorType > 0) Then
> rsCategory.MoveFirst
> Else
> rsCategory.Requery
> End If
> %>
> </select>
> </p>
>
> <label for="Submit"></label>
> <input type="submit" name="Submit" value="Display Products in this
> Category" id="Submit" />
> </form>
>
> </code>
>
> I just want to ass the drop down/select value to the URL and post back to
> the
> same page for a recordset to collect the value and display the specified
> results.
>
> Appreciate any feedback.
>