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.
id | male | female
1 | 5 | 3
form:
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<fieldset>
<legend>Gender</legend>
<div>
<input type="radio" name="gender" id="male" value="1" /><label for="male">Male</label><br />
<input type="radio" name="gender" id="female" value="1" /><label for="female">Female</label><br />
</div>
</fieldset>
<fieldset>
<div>
<label for="submit">Submit the form</label>
<input type="submit" name="submit" id="submit" value="Send your Input" />
</div>
</form>
Php database update:
$query = "UPDATE table SET x = x + 1 WHERE id = '1'";
$q = mysql_query($query);
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.
$selected_radio = $_GET['id'];
$query = "UPDATE table SET $selected_radio = $selected_radio + 1 WHERE id = '1'";
$q = mysql_query($query);