title: Form Decision - JavaScript / AJAX
body: <p>I have a little dilemma with the decision part of my form.  I'm attempting to create a form with radio buttons and a checkbox in an html page but I would like to retrieve data from my .php page. 
  I think there's an issue with the .php portion of the code. I'm getting a response from each 'if' statement regardless of the selections I make. 
  for Example - If I select radio1 &amp; checkbox I get "Radio One AND checkbox.Radio Two AND checkbox.Radio Three AND checkbox." This is the type of result with any query.</p>
  
  <p>Suggestions ?</p>
  
  <p>HTML FORM </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    // start the query string
      var QueryString = "form_test.php?";
      
        if (document.getElementById("radio1").checked == true  &amp;&amp; document.getElementById("box").checked) {
        
        QueryString = QueryString + "radio1=" + document.getElementById("radio1").value + "box=" + document.getElementById("box").value;
  
       } else if (document.getElementById("radio2").checked == true  &amp;&amp; document.getElementById("box").checked)  {
        
        QueryString = QueryString + "radio2=" + document.getElementById("radio2").value + "box=" + document.getElementById("box").value;
  
       } else if (document.getElementById("radio3").checked == true  &amp;&amp; document.getElementById("box").checked)  {
        
        QueryString = QueryString + "radio3=" + document.getElementById("radio3").value + "box=" + document.getElementById("box").value;
       } 
  
    //alert(QueryString);
    xmlHttp.open("GET", QueryString, true);
    xmlHttp.send(null);
    }
  
  &lt;/script&gt;&lt;/head&gt;
  
  &lt;body&gt;
  &lt;p&gt;Test Form&lt;/p&gt;
  &lt;form id="myform" name="myform" method="POST"&gt;
    &lt;p&gt;
      &lt;input type="radio" name="radbutton" id="radio1"&gt;
      &lt;label&gt;Radio One&lt;/label&gt;
    &lt;/p&gt;
    &lt;p&gt;
      &lt;input type="radio" name="radbutton" id="radio2"&gt;
      &lt;label&gt;Radio Two&lt;/label&gt;
    &lt;/p&gt;
    &lt;p&gt;
      &lt;input type="radio" name="radbutton" id="radio3"&gt;
      &lt;label&gt;Radio Three&lt;/label&gt;
    &lt;/p&gt;
    &lt;p&gt;
      &lt;input type="checkbox" name="check" id="box"&gt;
      &lt;label&gt;CheckBox&lt;/label&gt;
    &lt;/p&gt;
     &lt;input type="button" name="button" id="button" value="Test Form" onclick="ajaxFunction();"/&gt;
    &lt;/p&gt;
  &lt;/form&gt;
    &lt;p&gt;
      &lt;div id="OutputPane"&gt;
      &lt;/div&gt;
    &lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>PHP CODE</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  
  if ((isset($_GET['radio1']) || isset($_GET['box']))) {
      echo "Radio One AND checkbox.";
  } else {
   echo "Radio One";
  } 
  
  if ((isset($_GET['radio2']) || isset($_GET['box']))) {
      echo "Radio Two AND checkbox.";
  } else {
   echo "Radio Two.";
  }
  
  
  if (isset($_GET['radio3']) || (isset($_GET['box']))) {
      echo "Radio Three AND checkbox.";
  } else {
   echo "Radio Three.";
  }
  
  
  ?&gt;</code></pre>
  </div>
  </div>
  </p>