Forums

Format Checkboxes in email

Arkomat 13 Jul, 2010
Hi All,

I have a question. I'm using a form with a number of checkboxes. When I sent an email, the format in the email is "Extra's: {check1}". So far so good. The problem lies in the fact that the {check1} is displayed in the email separated by a comma.

So like this:

check1, check 2, check 3, check4 etc.



What I want is a sum up of all the items that were selected in the form when it was submitted. So what I want to do in the code is the replace the comma for a hard return like <br>.

So like this:

check1<br>check2<br>check3<br>check4<br> etc.



Does anybody know how to format the checked checkboxes?
Thanks in advance.

Greetz
Arkomat
GreyHead 14 Jul, 2010
Hi Arkomat,

This is a consequence of the ChronoForms array handling code that converts the checkbox array to a string. You need to re-work the conversion in the OnSubmit Before box. We'll change the name to 'check1a so that the original string value is still saved in the Database for future use.
<?php
$check1 = JRequest::getString('check1', '', 'post');
$check1 = str_replace(', ', '<br />', $check1);
JRequest::setVar('check1a', $check1);
?>

Then use {check1a} in the email template.

Bob
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger