2
I am trying to generate the MPDF, but this error appears:
PHP Parse error: syntax error, Unexpected 'foreach' (T_FOREACH)
This error is accusing in the second line that is the first foreach
.
$prova = unserialize($row['prova']);
$html = " <div class='row'>
".foreach($prova[0] as $idPergunta => $rowPergunta) {."
<div class='col-sm-6'>
<div class='row'>
<div class=''>
<div class='form-group'>
<h4><b>".echo $rowPergunta;."</b></h4>
</div>
</div>
</div>
<div class='row'>
<div class=''>
<div class='form-group'>
".foreach($prova[1][$idPergunta] as $rowRespostas) {."
".echo $rowRespostas;."
"}"
</div>
</div>
</div>
</div>
".$rowCount++;
if($rowCount % $numOfCols == 0) echo '</div><div class='row'>';
$i++; }."
".}."
</div>
";
Thank you so much for your help. Using the first example, this error appears
PHP Parse error: syntax error, unexpected '$rowPergunta'
.– Tiago
I opted for the first, because the indentation is visually better.
– Tiago
I didn’t pay attention and had a line that was being processed in the code before moving to the text. I fixed it in the edit.
– CypherPotato
See how it appears https://prnt.sc/oz933u
– Tiago
The way out of this
$html
goes to an interpreter that supports PHP? Apparently not. In this case, you will have to use preprocessing.– CypherPotato
I am using https://github.com/mpdf/mpdf
– Tiago
The Second worked out!
– Tiago
Thank you very much.
– Tiago
The only thing that is not happening is the formatting in two columns. You know to inform the reason?
– Tiago