Skip to main content
May 2, 2006
Question

Reference Form Field Value for URL

  • May 2, 2006
  • 2 replies
  • 289 views
This is an easy one, I know. But the few things I've tried haven't worked.

I have a form with a List/Menu and a button. The field is a list of Instruments:

<td class="Text"><select name="Instrument" class="Text" id="Instrument">
<option value="Acoustic Guitar" selected="selected">Acoustic Guitar</option>
<option value="Bass Guitar">Bass Guitar</option>
<option value="Drums">Drums</option>
<option value="Electric Guitar">Electric Guitar</option>
<option value="Harmonica">Harmonica</option>
<option value="Keys">Keys</option>
<option value="Mandolin">Mandolin</option>
<option value="Other">Other</option>
<option value="Percussion">Percussion</option>
<option value="Piano">Piano</option>
<option value="Violin">Violin</option>
<option value="Vocal">Vocal</option>
</select></td>

When the user clicks the button to submit the form (named form2), I have the button sending the user to another page. I need the URL to have the selected value from the list as the last parameter. I have:

<form id="form2" name="form2" method="post" action="AddMusician.asp?eventid=<%=EventInfo("EventID")%>&Instrument=<%Response.Form("Instrument")%>" />

And everything works except the Response.Form command. The button works, the URL appears with nothing after the Instrument=. I also tried setting the field to a variable (strInstrument) and using this:
<%
Dim strInstrument
strInstrument = Request.Form("Instrument")
%>

<form id="form2" name="form2" method="post" action="AddMusician.asp?eventid=<%=EventInfo("EventID")%>&Instrument=<%Response.Write strInstrument%>" />

Thanks for your help.

Rob
This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

May 3, 2006
That's what I needed. Thanks!
Inspiring
May 2, 2006
All server side processing takes place when the user receives the form.
There's no way for anything to appear in the URL there because nothing has
been selected yet. Only AddMusician.asp receives that information since
it's the page that receives the form when it's submitted.

If you want everything in the URL, switch your form method to GET instead of
POST.

"robmoulton" <webforumsuser@macromedia.com> wrote in message
news:e3825r$lqp$1@forums.macromedia.com...
> And everything works except the Response.Form command. The button works,
> the
> URL appears with nothing after the Instrument=. I also tried setting the
> field
> to a variable (strInstrument) and using this:
> <%
> Dim strInstrument
> strInstrument = Request.Form("Instrument")
> %>
>
> <form id="form2" name="form2" method="post"
> action="AddMusician.asp?eventid=<%=EventInfo("EventID")%>&Instrument=<%Respo
> nse.Write strInstrument%>" />
>