?
Solved

Radio buttons to select which ASP page to go to

Posted on 2002-05-08
7
Medium Priority
?
184 Views
Last Modified: 2010-04-07
Hi,
I have a HTM page that I have placed two radio buttons, a text box and a submit button onto.One of the radio buttons has a value of xxx the other a value of yyy.I want to set it up so that if I select radio button with yyy then press the submit button it goes to a certain asp page e.g. "1.asp" and passes the text I have put into the text box but if radio button xxx is selected when the submit button is pressed it goes to a different asp page e.g "2.asp" and still passes the text from the text box.

I can get it to submit the text info to one of the asp pages by putting the name of the page in the action field of the form post but cant see how to get it to change?
I am using dream weaver 4
ANy help or suggestions would be much appreciated
0
Comment
Question by:monitorwa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 17

Expert Comment

by:dorward
ID: 6996686
Combine the functions of the two ASP pages in to a single page by wapping them in a big if statement.

I don't know ASP but this PHP example should give you an idea as to how to implement it:

if ($myRadio == 1) {
    do_this();
    do_that();
    do_the_other();
} else {
    do_somthing_else();
    do_another_thing();
    think_of_more_boring_function_names();
}
0
 
LVL 1

Expert Comment

by:raid999
ID: 6998669
you can try this it works for me:

<form action="choosepage.asp" method="post">
<input type="radio" name="PageChoice" Value="Page1"> Page 1<BR>
<input type="radio" name="PageChoice" value="Page2"> Page 2<BR>
name<input type="text" name="name">
<input type="submit" value="Choose Page">&nbsp;&nbsp;<input type="reset"></form>

ChoosePage.asp

<%
  Option Explicite
  Dim strChoice
  Dim strName

  strChoice= Request.Form("PageChoice")
  strName= Request.Form("name")

  if strChoice= "Page1" then
     Response.Redirect "page1.asp?name="+strName
  Else
     Response.Redirect "page2.asp?name="+strName
  End if
%>
0
 
LVL 1

Expert Comment

by:raid999
ID: 6998675
Sorry in the last part you should use & not + sorry again
0
WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

 
LVL 1

Expert Comment

by:raid999
ID: 6998686
Sorry in the last part you should use & not + sorry again
0
 
LVL 1

Accepted Solution

by:
zeheb earned 300 total points
ID: 7036676
This should also work.
I check it in my machine and it work.

<HTML>
<HEAD>
   <SCRIPT LANGUAGE=javascript>
         function SelectPage()
         {
             if (document.YourForm.Radio(0).checked)
                 document.YourForm.action = "1.asp"
             else    
                 if (document.YourForm.Radio(1).checked)
                     document.YourForm.action = "2.asp"
         }
   </SCRIPT>
</HEAD>
<BODY>
    <FORM NAME="YourForm" METHOD="GET" OnSubmit="JavaScript:SelectPage()">
        <INPUT NAME="Radio" TYPE="radio" VALUE="xxx"> <BR>
        <INPUT NAME="Radio" TYPE="radio" VALUE="yyy"> <BR>
        <INPUT NAME="TextBox" TYPE="text"> <BR>
        <INPUT TYPE="submit">
    </FORM>
</BODY>
</HTML>
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 8148400
This question has been abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
   In the absence of responses, I may recommend DELETE unless it is clear
   to me that it has value as a PAQ.  Silence = you don't care
</note>

Cd&
0
 

Author Comment

by:monitorwa
ID: 8149011
Sorry guys - for some reason I hadnt been notified of any comments until just now? I actually figured it out a while ago but am happy to award the points as I have. As we all would have noticed what was Experts Exchange isnt anymore!
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…
Suggested Courses
Course of the Month7 days, 23 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question