PHP:表单中的POST配对复选框/文本字段

I have a form that is a list of check boxes. Next to each check box is a text field that goes with the check box. Below is an image of what I am talking about enter image description here

The text in red is the name attribute. My question is based off of whatever the user check marks, how do I match the paired text field without doing a bunch of if statements?

I know how to just post the check boxes and just post the text fields..separately. I guess I am stuck at how to pair the results. This is what I am using to $_POST the check boxes

if (isset($_POST['family_medical_history']))
{
    $_SESSION['patient_form']['family_medical_history'] = array();
    foreach ($_POST['family_medical_history'] as $key => $value)
    {
        $_SESSION['patient_form']['family_medical_history'][$key] = $_POST['family_medical_history'][$key];
    }
}
else
{
    $_SESSION['patient_form']['family_medical_history'] = "none";
}

Example HTML form

<div class="form-group col-sm-4">
    <label><input type="checkbox" name="family_medical_history[]" value="Crossed Eyes" /> Crossed Eyes</label>
</div>
<div class="form-group col-sm-4">
    <input type="text" class="form-control" id="" name="rel_crossed_eyes">
</div>

You can pair them by naming the inputs similarly for each checkbox/relationship pair to produce a two-member array for each item.

<div class="form-group col-sm-4">
    <label><input type="checkbox" name="rel_crossed_eyes[]" value="Crossed Eyes" /> Crossed Eyes</label>
</div>
<div class="form-group col-sm-4">
    <input type="text" class="form-control" id="" name="rel_crossed_eyes[]">
</div>

In the PHP, they will become pairs with the 0 element equal to the value of the checkbox input, and the 1 element equal to the text input. You can create an array of conditions and loop through each of the named inputs. You'll have to change your if statement to something else, for example the submit button:

$conditions = array("rel_blindness" => "Blindness", "rel_cataracts" => "Cataracts", "rel_crossed_eyes" => "Crossed Eyes", "rel_glaucoma" => "Glaucoma");

if (isset($_POST['submit'])){
    foreach ($conditions as $key => $value){
        if ($_POST[$key][0] == $value){//if the checkbox is checked
            $_SESSION['patient_form']['family_medical_history'][$key] = $_POST[$key][1];
        }
    }
}