Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8787929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:01:05+00:00 2026-06-13T22:01:05+00:00

Hoping somebody can help me with this. For some reason, the following form code

  • 0

Hoping somebody can help me with this. For some reason, the following form code always gives the ‘route’ radio button value as being ‘m’, even when the the option with value ‘s’ is selected.

echo "<b><u>Route Information</u></b><br><br>";

echo "Select Route Name: <input type='radio' name='route' id='route1' value='s' onclick='switchRoute();' CHECKED><br>";
echo "<div id='txtLocation'><select name='route_name' id='route_name'>
    <option value='0000'>... select a location ...</option>";
echo "</select></div><br><br>";

echo "Or enter a new route (select the radio button for this option):<input type='radio' name='route' id='route2' value='m' onclick='switchRoute();'><br>";
echo "&nbsp&nbsp&nbsp&nbspRoute Name:<br>&nbsp&nbsp&nbsp&nbsp<input name='new_route_name' size='50' disabled='true' class='input-xlarge'><br><br>";
echo "&nbsp&nbsp&nbsp&nbspRoute Grade:<br>&nbsp&nbsp&nbsp&nbsp<input type='number' name='route_grade'  class='input-mini' disabled='true'><br><br>";
echo "&nbsp&nbsp&nbsp&nbspRoute Description <i>(optional)</i>:<br>&nbsp&nbsp&nbsp&nbsp<textarea name='route_description' class='input-xxlarge' rows='3' disabled='true'></textarea><br><br>";

The route_name select is filled out with the follwing ajax code:

function showUser(str)
{
    if (str=="")
      {
      document.getElementById("txtLocation").innerHTML="";
      return;
      } 
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
      xmlhttp.onreadystatechange=function()
      {
      var output = '';
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        output = xmlhttp.responseText;
        document.getElementById("txtLocation").innerHTML=output;
        }
      }
    xmlhttp.open("GET","../model/selected_loc.php?l="+str,true);
    xmlhttp.send();
}

Which is called by this PHP code:

echo "<b><u>Location Information</u></b><br><br>";
echo "<select name='loc_id' id='loc_id' onchange='showUser(this.value)'><option value='0000'>... select a location ...</option>";
$result = mysql_query("SELECT loc_id, name FROM location ORDER BY name");

while ($row = mysql_fetch_array($result))
{
    $id = $row['loc_id'];
    $name = $row['name'];
    echo "<option value='{$id}'>{$name}</option>";
}
echo "</select><br><br>";

There is also this javascript code acting on the form.

function switchRoute()
{
    if (document.getElementById('route2').checked)
    {
        document.submitroute.route_name.disabled=true;
        document.submitroute.new_route_name.disabled=false;
        document.submitroute.route_grade.disabled=false;
        document.submitroute.route_description.disabled=false;

    }
    else if (document.getElementById('route1').checked)
    {
        document.submitroute.route_name.disabled=false;
        document.submitroute.new_route_name.disabled=true;
        document.submitroute.route_grade.disabled=true;
        document.submitroute.route_description.disabled=true;
    }
}

Thanks for any assistance you can give me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:01:06+00:00Added an answer on June 13, 2026 at 10:01 pm

    I feel rather silly, however I have solved it myself.

    In the page which received the data I had:

    if ($route = "m")
    

    Instead of:

    if ($route === "m")
    

    This was reassigning the $route variable instead of comparing it. I swear I checked that earlier, however small things like that are sometimes easily missed.

    Thanks to all those who helped or looked at my question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am hoping that somebody can help me out with this question. The following
Hi I am hoping that somebody can help me to tweak this JQuery code
I know I am doing this wrong, so I'm hoping somebody here can help.
I couldn't find this on here already, and am hoping somebody can help. I
Hoping that someone can help clear up this very annoying situation I find myself
Okay, this may be trivial, but I'm hoping somebody can give me a straightforward
I'm really hoping you can help me with this. I have a date outputted
I know nothing of C# so I'm hoping somebody here can help. So my
I've written some jquery to solve this problem. Although it works, I can't help
If I try the getting-started on http://flexmojos.sonatype.org/getting-started.html I get some errors. Can somebody help

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.