I am sending three arrays to the email action (first_name, last_name, rating). I have the email template listed as:
The email returns the following:
As you can see, the array is being sent just fine. Is there a way I can format the email so it appears like this:
I wouldn't even mind if the simplest way is to put them all on one line, but in the order shown.
Thanks.
<tr>
<td>
Name and Rating:
</td>
<td>
{first_name} {last_name} {rating}
</td>
</tr
The email returns the following:
Name and Rating: Firstname1, Firstname2, Firstname2 Lastname1, Lastname2, Lastname2 865,520 , 1500
As you can see, the array is being sent just fine. Is there a way I can format the email so it appears like this:
Firstname1 Lastname1 865
Firstname2 Lastname2 520
Firstname3 Lastname3 1500
I wouldn't even mind if the simplest way is to put them all on one line, but in the order shown.
Thanks.
Hi chriso0258 ,
You can add a Custom Code action before your Handle arrays action and add code like this:
Bob
You can add a Custom Code action before your Handle arrays action and add code like this:
<?php
$name_and_rating = array();
foreach ( $form->data['first_name'] as $k => $v ) {
$name_and_rating[] = "{$v} {$form->data['last_name'][$k]} {$form->data['rating'][$k]}";
}
$form->data['name_and_rating'] = implode("\n", $name-and_rating);
?>
Then use {name_and_rating} in your email template.Bob
Thanks Bob. Since my post, I changed the input to what I think is a multidimensional array instead.
I think I still need to do what you have suggested, but I'm not sure how to format the foreach because of the new array structure.
<TR>
<TD> <input type="text" name="mbr_info[][first_name]"/></TD>
<TD> <input type="text" name="mbr_info[][last_name]"/></TD>
<TD> <input type="text" name="mbr_info[][rating]"/></TD>
</TR>
I think I still need to do what you have suggested, but I'm not sure how to format the foreach because of the new array structure.
Please disregard my last post. Turns out I can use the mbr_info[] directly using the Handle Arrays action. Thank you Bob for your input. It has been a help (as usual).😀
This topic is locked and no more replies can be posted.