$staffRowCount = count($_POST['staff_discipline']);
for ($i = 0; $i < $staffRowCount; $i++) {
$replacements = array('staff_discipline' => $_POST['staff_discipline'][$i]);
$replacements1 = array('staff_contractor' => $_POST['staff_contractor'][$i]);
$replacements2 = array('staff_name' => $_POST['staff_name'][$i]);
$replacements3 = array('staff_email' => $_POST['staff_email'][$i]);
$replacements4 = array('staff_job_title' => $_POST['staff_job_title'][$i]);
$replacements5 = array('staff_date' => $_POST['staff_date'][$i]);
}
$templateProcessor->cloneBlock('block1',$staffRowCount,true,false, $replacements);
$templateProcessor->cloneBlock('block2',$staffRowCount,true,false, $replacements1);
$templateProcessor->cloneBlock('block3',$staffRowCount,true,false, $replacements2);
$templateProcessor->cloneBlock('block4',$staffRowCount,true,false, $replacements3);
$templateProcessor->cloneBlock('block5',$staffRowCount,true,false, $replacements4);
$templateProcessor->cloneBlock('block6',$staffRowCount,true,false, $replacements5);
these are the placeholders I'm using in template. I have put each placeholder within ${block} ${/block} as follows.
${block1}${staff_discipline}${/block1}, ${block2}${staff_contractor}${/block2}, ${block3}${staff_name}${/block3}, ${block4}${staff_email}${/block4}, ${block5}${staff_job_title}${/block5}, ${block6}${staff_date}${/block6}
when I'am executing the script it shows large binary text which includes so many symbols and word file not being created. what am I doing wrong? please help me with it. thankyou
I have tried CloneRowAndSetValues method, I have also looped through SetValues method but every time there occurred fetal error. I have tried the following approach as well. //for loop starts here.
$values[] = array( ['staff_discipline' => $_POST['staff_discipline'][$i],
'staff_contractor' => $_POST['staff_contractor'][$i],
'staff_name' => $_POST['staff_name'][$i],
'staff_email' => $_POST['staff_email'][$i],
'staff_job_title' => $_POST['staff_job_title'][$i],
'staff_date' => $_POST['staff_date'][$i]
]);
//for loop ends here.
$templateProcessor->cloneRowAndSetValues('staff_row', $values);