I have a booking form which uses a function (attendees_full_info) to output all the data entered into an e-mail. Now the formatting bothers me because all labels and input are in one line.
I have the following code:
if(is_array($reg_form) and count($reg_form))
{
foreach($reg_form as $field_id=>$value)
{
// Placeholder Keys
if(!is_numeric($field_id)) continue;
$type = $reg_fields[$field_id]['type'];
$label = isset($reg_fields[$field_id]) ? $reg_fields[$field_id]['label'] : '';
if(trim($label) == '') continue;
if($type == 'agreement')
{
$label = sprintf(__($label, 'mec'), '<a href="'.get_the_permalink($reg_fields[$field_id]['page']).'">'.get_the_title($reg_fields[$field_id]['page']).'</a>');
$attendees_full_info .= $label.': '.($value == '1' ? __('Yes', 'mec') : __('No', 'mec'))."\r\n";
}
else
{
$attendees_full_info .= __($label, 'mec').': '.(is_string($value) ? $value : (is_array($value) ? implode(', ', $value) : '---'))."\r\n";
}
}
}
The result is the following:
Here's what I've already tried. After the ":" i have inserted \r\n or only \n. But this does not work.
example:
if($type == 'agreement')
{
$label = sprintf(__($label, 'mec'), '<a href="'.get_the_permalink($reg_fields[$field_id]['page']).'">'.get_the_title($reg_fields[$field_id]['page']).'</a>');
$attendees_full_info .= $label.': \r\n'.($value == '1' ? __('Yes', 'mec') : __('No', 'mec'))."\r\n";
}
else
{
$attendees_full_info .= __($label, 'mec').': \r\n'.(is_string($value) ? $value : (is_array($value) ? implode(', ', $value) : '---'))."\r\n";
}
Does anyone have an idea of how I can adapt the code accordingly?