I have two checkbox fields:
AAA (with the choices A, B, C)
BBB (with the choices 10, 20, 30)
In made in the front end the followoing choices:
In AAA: A, B
In BBB: 20, 30
Now I want to calculate the unique combinations, so I want (as text): A20, B20, B20, B30, also A20 B20 B20 B30 will do, the comma is not needed.
I made this:
function class_tijd($post_id)
{
$class = get_field('AAA');
$tijd = get_field('BBB');
foreach ($class as $value1) {
$value1 = implode(' ', $class);
foreach ($tijd as $value2) {
$value2 = implode(' ', $tijd);
}
$value = $value1 . $value2;
}
$field_name = "classtijd";
update_field($field_name, $value, $post_id);
The result I get is: A B20 30
I found out that I could solve yhis with possible array_merge, but can not find the right way to get it done. Any ideas?