Using 2 diff response page to load based on form object selection

Currently my perl script goes to one response/return page after the user submits the form data input. The path to the page is coded as $html_path="/usr/local/myserverhtml/response.html

Within the form's html form object are two radio buttons
 <input type="radio" value="yes" name="helpneeded">
 <input type="radio" value="no" name="helpneeded">

What I'm trying to accomplish is to have the user get a return page that corresponds with whichever of the radio button he selected on the form, e.g., if user selects "NO" for "helpneeded" then he gets to the helpneeded.html page after he submits the form results.

I tried embedding a javascript and used the return/response html pages as values but that would be incorrect, since I want the values to be retained as either "YES|NO"

Can anyone help me with this please?
Thanks.
-jamaica-
           
jamaicaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

lexxwernCommented:
does the form get submitted by POST or GET ?
0
lexxwernCommented:
<offtopic>
and have i helped you in the other Q?
</offtopic>
0
lakshmisubramCommented:
after choosing the radio button do you want to throw different html pages based on the chosen radio buttons ?
can you explain in detail more?
0
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

lakshmisubramCommented:
Depending on form object selection , you want to load different pages . right ? This is the thing you need to do ?

<html>
<head>
<script language="JavaScript">
function submitForm()
{
   if (document.test.helpneeded[0].checked)
   {
     window.location ="http://www.experts-exchange.com";
   }
   else if (document.test.helpneeded[1].checked)
   {
     window.location ="http://www.yahoo.com";
   }
}
</script>
</head>
   
<form name="test">
<input type="radio" name="helpneeded" value="yes" onClick="submitForm();">yes
<input type="radio" name="helpneeded" value="no" onClick="submitForm();">no
</form>
</html>
0
jamaicaAuthor Commented:
lexxwern, the form uses POST and yes you have helped me with one QID :)

lakshmisubram, the html page is loaded *when* the user selects the "submit" button but the html page loaded must relate to the radiobutton selection. Therefore onClick wouldn't work.

I'd tried it using the script below in perl but what I get is the actual radiobutton <input value="whatevervalueishere">

<input type="radio" name="response" value="yes_response.html" onclick="document.forms[0].action = this.value" />  YES
<br />
<input type="radio" name="response" value="no_response.html" onclick="document.forms[0].action = this.value" />  NO

I ran into 2 probs with this method above.
#1. The POST method does not work with this ... it didn't work and then when I hit back and resubmitted the form, it worked BUT the value posted in the received email showed as the html page link (i.e., "no_response.html") AND the POST used the $html_path="response.html"

The main focus are ...

a. to get radio button selection to correspond to an html page, whereas, the user selects the SUBMIT button and if the form detected that "NO" was selected then he's sent to "no_response.html"

b. Have the POST read the $html_path for either "no_response.html" or "yes_response.html" based on the radiobutton selection.

If I can't accomplish this then I'll have to figure out how to parse data field entries from form1 to form2 and have form2 POST the form data and send the user to the responding/feedback page.
0
lakshmisubramCommented:
Does the below code help you ?

<html>
<head>
<script language="JavaScript">
function submitForm()
{
  if (document.test.helpneeded[0].checked)
  {
   

document.test.action="http://www.experts-exchange.com";
  }
  else if (document.test.helpneeded[1].checked)
  {
    document.test.action="http://www.yahoo.com";
  }
}
</script>
</head>
 
<form name="test">
<input type="radio" name="helpneeded" value="yes">yes
<input type="radio" name="helpneeded" value="no">no
<input type="submit" name="submit" value="Submit"

onClick="submitForm();">
</form>
</html>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jamaicaAuthor Commented:
From: lakshmisubram  Date: 07/10/2002 10:40AM PST  

Even though this is not the way I really want it but I have the option of doing it this way...

I'll award you with this, as it better works out what I'm working on. I now have 3 html pages. The first/intro page asks user to select an appropriate radio button "Yes|No".

If user selects Yes, then he's sent to Pg1.html that uses cgi perl post method and encoded return page yes_ret.html

If user selects No, then he's sent to Pg2.html that uses cgi perl, method=post and encoded return page no_ret.html.

Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.