Custom email template-remove brackets

pgrnycomdir 23 Jun, 2023
I use a custom template for one of my forms.

The return information for the following is not formatted the way I would like to see it.

<p>{data:regions}</p>

Returns variable data chosen with brackets such as:

["5"]["7"]

How can I have it return the variable data and strip out the brackets and quote marks?? In Chronoforms 6 the code was:
$region_array = array(
"1" => 'Region 1',
"2" => 'Region 2',
"3" => 'Region 3',
"4" => 'Region 4',
"5" => 'Region 5',
"6" => 'Region 6',
"7" => 'Region 7',
"8" => 'Region 8',
"9" => 'Region 9'
);

return implode(", ", array_intersect_key($region_array, array_flip($this->data("regions"))));



Thank you in advance.
Donna
pgrnycomdir 27 Jun, 2023
Is there nobody out there than can help me? I'm not a coder.

The chronoforms 6 allowed for php in the set-up section that I put the above code. So the custom template did not have the brackets or quote marks with the chosen radio button choice from the user.

Anyone????
Max_admin 28 Jun, 2023
Hi Donna,

The same code should work on v7, but the to get the value from the PHP action you need to use:
{var:php_action_name}


Where php_action_name is the name of your PHP action
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
pgrnycomdir 28 Jun, 2023
Max, that's great, but where do I put this???
Max_admin 03 Jul, 2023
Answer
wherever you need to use the value returned from the PHP code action.

Or if you will use it in another PHP block then use $this->get("php_action_name")
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
pgrnycomdir 04 Jul, 2023
Max,

OK, but where does the PHP go within the form in Chronoforms 7???

Thank you in advance,
Donna

Side note: Without any instructions this version of Chronoforms is difficult to use. It may be fine for those who know how to code and can understand coding but for the common lay person this is very difficult to even do a somewhat simple custom form with choices in it and multiple emails for distribution.

Video training is a great idea, but so far it only covers the simple common sense stuff and does not get into any customization. We all have to rely on you or someone on the forums who is willing to share their knowledge.
You need to login to be able to post a reply.

VPS & Email Hosting 20% discount
hostinger