Migration from Chronoforms 5 to 7

Mwa19 05 Jul, 2022
I'm trying for a long time now to migrate my search form from Chronoforms 5 to 7. However there is one thing that I cannot get to work. That is the following piece of code:
<?  $group_array = array();
foreach ( $form->data['groups'] as $v ) {
$group_array[] = $v['group_id'];
}
if ( in_array('10', $group_array) ) {
$form->data['Repertorium'][] = '0';
}

if ( in_array('11', $group_array) ) {
$form->data['Repertorium'][] = '2';
}
if ( in_array('16', $group_array) ) {
$form->data['Repertorium'][] = '1';
}
if ( in_array('15', $group_array) ) {
$form->data['Repertorium'][] = '3';
}
if ( in_array('12', $group_array) ) {
$form->data['Repertorium'][] = '4';
}
if ( in_array('13', $group_array) ) {
$form->data['Repertorium'][] = '5';
}
if ( in_array('14', $group_array) ) {
$form->data['Repertorium'][] = '6';
}


?>
I know that $form has to be changed tot $this. But what other changes do I have to make to get this to work? I really hope someone can help me. It's a shame that there is no manual for chronoengine 7.
Colnem 05 Jul, 2022
Hi

Syntax errors PHP:
[em]$var['item';[/em]

You have to write that:
$var['item'];
Mwa19 05 Jul, 2022
Everytime I try to post the code, it is messed up. I will make a screenshot.
Mwa19 05 Jul, 2022
<? 
$group_array = array();
   
foreach ( $form->data['groups'] as $v ) {
     
$group_array[] = $v['group_id'];
    }
if ( in_array('10', $group_array) ) {
  $form->data['Repertorium'][]
= '0';
}
if ( in_array('11', $group_array) ) {
 
$form->data['Repertorium'][] = '2';
}
if ( in_array('16', $group_array) ) {
 
$form->data['Repertorium'][] = '1';
}
if ( in_array('15', $group_array) ) {
 
$form->data['Repertorium'][] = '3';
}
if ( in_array('12', $group_array) ) {
 
$form->data['Repertorium'][] = '4';
}
if ( in_array('13', $group_array) ) {
 
$form->data['Repertorium'][] = '5';
}
if ( in_array('14', $group_array) ) {
 
$form->data['Repertorium'][] = '6';
}
   
?>
Mwa19 05 Jul, 2022
If someone can tell me how I have to post the code? It messes up everytime I save it....
Mwa19 05 Jul, 2022
Answer
I have ][]='0';} after [Repertorium'
You need to login to be able to post a reply.