title: How do I get value of selected radio button
body: <p>How do I get value of selected radio button. to use it as a coordinate for drawing a rectangle (or circle. ) Eventually I want to get average of all answers for same purpose. </p>
  
  <p>Here is code of my 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>&lt;form id="FormName" action="draw.php" method="get" name="FormName"&gt;
  
    &lt;table border="3"&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;span class="hiddenDiv"&gt; Here is my question &lt;/span&gt;
        &lt;/td&gt;
        &lt;td&gt;&lt;span class="hiddenDiv"&gt;
              &lt;input type = "radio"  name = "g1" id="g1q1"  value = "-3"  /&gt;
              &lt;/span&gt;
        &lt;/td&gt;
        &lt;td&gt;&lt;span class="hiddenDiv"&gt;
                &lt;input type = "radio"  name = "g1" id="g1q2"  value = "-2" /&gt;
              &lt;/span&gt;
        &lt;/td&gt;
        &lt;td&gt;&lt;span class="hiddenDiv"&gt;
                &lt;input type = "radio"  name = "g1" id="g1q3"  value = "-1" /&gt;
              &lt;/span&gt;
        &lt;/td&gt;
        &lt;td&gt;&lt;span class="hiddenDiv"&gt;
                &lt;input  name = "g1" type = "radio" id="g1q4"  value = "0" /&gt;
              &lt;/span&gt;
        &lt;/td&gt;
        &lt;td&gt;&lt;span class="hiddenDiv"&gt;
                &lt;input type = "radio"  name = "g1" id="g1q5"  value = "1" /&gt;
              &lt;/span&gt;
        &lt;/td&gt;
        &lt;td&gt;&lt;span class="hiddenDiv"&gt;
                &lt;input type = "radio"  name = "g1" id="g1q6"  value = "2" /&gt;
              &lt;/span&gt;
        &lt;/td&gt;
        &lt;td&gt;&lt;span class="hiddenDiv"&gt;
                &lt;input type = "radio"  name = "g1" id="g1q7"  value = "3" /&gt;
              &lt;/span&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>And here is draw.php that i am trying to use.</p>
  
  <pre><code>&lt;?php  
      // Create a 55x30 image
      $im = imagecreatetruecolor(620, 620);
      $white = imagecolorallocate($im, 255, 255, 255);
      $black = imagecolorallocate($im, 130, 130, 130);
      $red = imagecolorallocate($im, 255, 0, 0);
      $answer = 'g1q1';
       //$rrr = $('input[name=g1]:checked','FormName');
  
      // Draw a white rectangle
      imagefilledrectangle($im, 0, 0, 620, 620, $white);
      imagefilledrectangle($im, 24,  24, 600, 600, $black);
      imageline($im, 0, 310, 620, 310, $white);
      imageline($im, 310, 0, 310, 620, $white);
      imagefilledrectangle($im, $answer*12, $answer*12, $answer*12+12, $answer*12+12, $red);
      //imagefilledellipse 
      // Save the image
      imagepng($im, './imagefilledrectangle.png');
      imagedestroy($im);
  
      //Get the file
      $content = file_get_contents('./imagefilledrectangle.png');
  
      echo '&lt;img src="'.$snippet_theme.'./imagefilledrectangle.png" /&gt;'; 
  ?&gt;
  </code></pre>