Q:

If radio button checked submit value?

i am currently working with a simple form which has two radio buttons for example 
<form method="post" action="" autocomplete="off" role="form" class="snippet-form">

    <div class="form-group ">
        <label for="title">Title</label>
        <input type="text" class="form-control" name="title" value="">
     </div>

    <div class="form-group">
        <label class="radio-inline">
            <input checked="checked" name="state" type="radio" value="public"> Public
        </label>
        <label class="radio-inline">
            <input name="state" type="radio" value="private">  Private
        </label>
    </div>

    <button type="submit" class="btn btn-default">Publish</button>

</form>

so when the form is submitted the title and one of the two radio button values are then stored into a database.
The trouble i am having is, the values of radio buttons have to be PUBLIC or PRIVATE if not it breaks functionality on the rest of the site as some things are stored privately and publicly. 
For example if somebody where to edit the value in browser and submitted the form, it would submit the edited value.
Is there a way using php to put a check in place so if either one of the radio buttons is checked it will then submit a value on the backend?

A:

something like this?
if(isset($_POST['state'])){
  if($_POST['state'] == 'public' || $_POST['state'] == 'private'){
    //proceed your work
  } else {
    //Notify user
  }
}

Check for the required value and if user hasn't entered required value set default value and proceed or notify user.

