Answer Source

I will try to help you. If I got your question right you have a form, which has a radio button and you need to confirm which option has been selected to save it in your database. Is that correct? Well If that the case you could do something like this.

Lets say you have a radio button that looks something like this:

  <input type="radio" name="gender" <?php if (isset($gender) && $gender=="female") echo "checked";?> value="female">Female
  <input type="radio" name="gender" <?php if (isset($gender) && $gender=="male") echo "checked";?> value="male">Male

When your form has been posted you can get the value like this:

if (empty($_POST["gender"])) {
    $genderErr = "Gender is required";
  } else {
    $gender = test_input($_POST["gender"]);

function test_input($data) {
  $data = trim($data);
  $data = stripslashes($data);
  $data = htmlspecialchars($data);
  return $data;

And them just create a query to your DB.

I hope this helps. Good luck!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download