Add multiple values from 2 inputs to one post variable

I’m fairly novice so please bear with me…
I’m trying to grab values from a checkbox and depending on the selection, I have conditional logic set to show two further radio button options and I need to grab that value also. I’ve looked at how to concatenate values and have come up with the following:

if ($_POST[‘input_48’] == ‘ValueX’)
{
$_POST[‘input_48’] = rgpost( ‘input_48’ ) . “\n” . rgpost( ‘input_50’ );
} else {
$_POST[‘input_48’] = $_POST[‘input_48’];
}

Some further detail…

1.) If checkbox one is selected > no further conditional logic > grab the value of input field

2.) If checkbox two is selected > conditional logic and show two radio button options > Add that selected option to the checkbox value and join them up

Any help would be appreciated.

The concept of this code looks OK. Where do you need help? Is something not working for you? We’ll need more detail (all the code including the add_filter line, and to see the form) to know where this is going wrong. Additionally, the built in logging with your own custom logging statements will be a great help here, to see if this variables contain what you expect them to:

Enabling logging

Adding your own custom logging statements