input box and dropdown to asp

G

Guest

I have a form with two input boxes. When you submit it, it goes to an asp
page. Is it possible to add a dropdown box that depending on the choice,
would go to a different asp page?
 
S

Stefan B Rusynko

Not directly since the form action can not be changed client side
- and the user is selecting the dropdown client side
But what you do on the receiving page is redirect to the other page(s) based on the form field value
(say the field is named "Action")

<%
Session("Action") = Request.Form("Action")
If Session("Action") = "Process1" Then
Response.redirect "Process1.asp"
' or process it differently here
ElseIF Session("Action") = "Process2" Then
Response.redirect 'Process2.asp"
' or process it differently here
Else
'your normal post processing code here - say from Process.asp"
End If
%>

Alternatively use a Case statement if you precisely know all values
<%
Session("Action") = Request.Form("Action")
Select Case Session("Action")
Case "Process1"
Response.redirect "Process1.asp"
' or process it differently here
Case "Process2"
Response.redirect "Process2.asp"
' or process it differently here
Case Else
'your normal post processing code here - say from Process.asp"]
End Select
%>

If you redirect to another page and you need the other form field values you will also need to set all the field values as Session
variables before you redirect
- call any Session variables on the receiving page as

<%
Action = Session("Action")
%>

--




|I have a form with two input boxes. When you submit it, it goes to an asp
| page. Is it possible to add a dropdown box that depending on the choice,
| would go to a different asp page?
 

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

Top