title: Give value to radio button php and save to sql
body: <p>I have a little problem that i have been struggling for the last 16hrs I can find a solution for this... I really really need some help please...</p>
  
  <p>I have the form which is generated by a query based on users ID...</p>
  
  <pre><code>ID-1 Question 1
   rad-btn ID-1 group 1 value 0 answer x
   rad-btn ID-2 group 1 value 0 answer x
   rad-btn ID-3 group 1 value 0 answer x
  
  ID-2 Question 2
   rad-btn ID-4 group 2 value 0 answer x
   rad-btn ID-5 group 2 value 0 answer x
   rad-btn ID-6 group 2 value 0 answer x
  
  ID-4 Question 3
   rad-btn ID-6 group 4 value 0 answer x
   rad-btn ID-7 group 4 value 0 answer x
   rad-btn ID-8 group 4 value 0 answer x
  </code></pre>
  
  <p>to get that "form" I use an sql as follow</p>
  
  <pre><code>$padreQR = mysql_query("SELECT * FROM ph_sec_preguntas WHERE s_codigo = '$secc1' ");
  
  while ($arrayP = mysql_fetch_array($padreQR)) {
      $preguntasPP = $arrayP['pregunta_id'];
      $preguntass = mysql_query("SELECT * FROM preguntas_p WHERE question_id = '$preguntasPP' ");
      while ($q1 = mysql_fetch_array($preguntass)) {
          $qid = $q1['question_id'];
          $pp1 = $q1['question'];
          $er = $qid;
          echo '"&lt;h3&gt;' . $pp1 . '&lt;/h3&gt;'; // Ya tenemos las preguntas segun el usuario
          $rrr = mysql_query("SELECT * FROM respuestas WHERE question_id = '$qid' ");
          while ($arrayRR = mysql_fetch_array($rrr)) {
              $respuestas = $arrayRR['answer'];
              $correcto = $arrayRR['correct'];
  
  
              echo '&lt;label style="cursor:pointer;"&gt;&lt;input type="radio" name="' . $er . '" value="' . $correcto . '"&gt;' . $respuestas . '&lt;/label&gt;';
          }
      }
  };
  </code></pre>
  
  <p>it may be not the best way to do it, for it works...</p>
  
  <p>So what I need is to save this information but not all, I only need:</p>
  
  <pre><code>userID, questionID, and the answer that was selected
  </code></pre>
  
  <p>my problem is, how do I get the selected radio button? and get the ID from that answer, I don't need to know the value, just which radio button was select and so I can get the ID from that button, that way I can save it to the sql, the ID came from the SQL, the value will always be 1 or 0...</p>
  
  <p>Right now I'm only showing 3 questions with multiple choices, but the idea is to have about 20 questions in a single page...</p>
  
  <p>Thank you for taking the time to read my question... </p>