Я получил свое решение:
<?php
$dosage_form_list_exist = preg_replace('/\s*,\s*/', ',',
$dosage_form_list_exist); // It removes spaces after the comma only not
between the values like "Oral Solutions" etc
// $dosage_form_list_exist = str_replace(' ', '', $dosage_form_list_exist);
// It removes all the spaces from the Variable
$dosage_list = explode(',',$dosage_form_list_exist);
foreach ($dosage_form_list as $val) {
?>
<input type="checkbox" name="dosage_form_input[]" value="<?php echo
$val['dosage_form']?>" <?php echo (in_array($val['dosage_form'],$dosage_list)
? 'checked' : ''); ?>>
<?php echo $val['dosage_form'];?>
<?php
}
?>