title: Php update database column using radio button id
body: <p>Trying to make a simple database and form to collect data. I am trying to increment the value in the tables column but dont know how to tell the sql to update the column based off of the id value from the radio buttons. Any help would be great.</p>
  
  <p>id | male | female</p>
  
  <p>1  |   5  |    3</p>
  
  <p>form:</p>
  
  <pre><code>&lt;form method="post" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;"&gt;
  
  &lt;fieldset&gt;
  &lt;legend&gt;Gender&lt;/legend&gt;
  &lt;div&gt;
  &lt;input type="radio" name="gender" id="male" value="1" /&gt;&lt;label for="male"&gt;Male&lt;/label&gt;&lt;br /&gt;
  &lt;input type="radio" name="gender" id="female" value="1" /&gt;&lt;label for="female"&gt;Female&lt;/label&gt;&lt;br /&gt;
  &lt;/div&gt;
  &lt;/fieldset&gt;
  &lt;fieldset&gt;
  &lt;div&gt;
  &lt;label for="submit"&gt;Submit the form&lt;/label&gt;
  &lt;input type="submit" name="submit" id="submit" value="Send your Input" /&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Php database update:</p>
  
  <pre><code>$query = "UPDATE table SET x = x + 1 WHERE id = '1'";
  $q = mysql_query($query);
  </code></pre>
  
  <p>From looking around ive been trying to use something like this but cant seem to get the checked radio value to be pulled in. Think I am missing something from the form to tell what radio button has been checked and to post that on submit.</p>
  
  <pre><code>$selected_radio = $_GET['id'];
  $query = "UPDATE table SET $selected_radio = $selected_radio + 1 WHERE id = '1'";
  $q = mysql_query($query);
  </code></pre>