AllExperts > Experts 
Search      

Active Server Pages Programming (ASP)

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Active Server Pages Programming (ASP) Answers
Question Library

Ask a question about Active Server Pages Programming (ASP)
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Jeff Allen
Expertise
I can answer basic to intermediate questions related to Classic ASP.I can answer Intermediate to Advanced questions CSS& HTML, and basic questions about JavaScript and Ajax. I can also answer questions related to web page accessibility under US Section 508.

Experience
I have 8 years experience with HTML. I have been developing in ASP, VBScript and CSS for two years each. I also currently work as web developer.

Organizations
IWA-HWG

Education/Credentials
I have a BA in English with minors in Web Design and Scientific and Technical Writing

 
   

You are here:  Experts > Computing/Technology > Business Software > Active Server Pages Programming (ASP) > Forms

Topic: Active Server Pages Programming (ASP)



Expert: Jeff Allen
Date: 8/7/2006
Subject: Forms

Question
Hi Jeff,

I'm just starting with ASP and came to a dead end.
I'm trying to create a simple page with a form that has few select buttons, and depending on what the user selects I want to display specific page. Say they select "volvo" I want to display "volvo.html" or should that be "volvo.asp", no idea?

So here is my html:
<form name=”selection” action="display.asp" method="get">
<select name="cars”>
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="fiat">Fiat</option>
  <option value="audi">Audi</option>
</select>
<input type="submit" value="Submit">
</form>

So, how do I process the info from the form to display a specific page?

I would appreciate any help you could give me!

Thanks a lot & regards,
Bobbie


Answer
Bobbie, actually it's fairly simple. First change your form method from "get" to "post". Secondly, you could redirect to either volvo.html, volvo.html or volvo.asp whichever you wanted, but whichever extension you choose to use try to be consistent, it will save headaches in the long run. Another option however, if you are connecting to a database for that information is that you could display it all in display.asp by querying the database based ont he value of myCar but that is bit more tricky to do so I will show you how to do the redirect.

Now, let's go to display.asp. What you can do is something like this:

<%
 'Get the value of the cars select box
 Dim myCar : myCar = Request.Form("cars")
 select myCar
   case "volvo"
      response.redirect "volvo.htm"
   case "saab"
      response.redirect "saab.htm"
   case "fiat"
      respone.redirect "fiat.htm"
   case "audi"
      response.redirect "audi.htm"
   case else
      response.write "Please press the back button and select a make of car to see information pertaining to that make."   
 end select
%>

This should do it. Let me know if this works for you.

Jeff

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.