title: Get JS Value for PHP URL
body: <p>I have a script that gets the value from the checked box client side like this: </p>
  
  <pre><code>var checkedValue = null; 
  var inputElements = document.getElementsByClassName('checkbox');
  for(var i=0; inputElements[i]; ++i){
    if(inputElements[i].checked){
         checkedValue = inputElements[i].value;
         break;
    }
  }
  </code></pre>
  
  <p>Here is the check box: </p>
  
  <pre><code>&lt;input id='cb10' name='answer[]' value='$correct' class='checkbox' type='checkbox'&gt;
  </code></pre>
  
  <p>Then I have php code to display the "next" button where i am url encoding variables that I need on the next page like this: </p>
  
  <pre><code>echo "&lt;a href='idmatch_process.php? answer="+checkedValue+"&amp;totalcorrect=". urlencode($totalcorrect)  ."&amp;escalation=". urlencode($escalation) ."&amp;correctrule=".  urlencode($correctrule) ."&amp;page=" . $next_page ."'&gt;Next&lt;/a&gt;";
  </code></pre>
  
  <p>I need "answer" to equal the checked value but I can not seem to get it to work. Any thoughts? </p>