0
You guys talk beauty ? So I can show all the content in a PDF with html I need to concatenate line by line, so everything Ok. The problem is that when I try to put the $_POST method to show the contents of a dynamic form, I get an error:
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\xampp\htdocs\Emp\gerar_pdf.php on line 176
The line that comes from this error is this:
$html .="<td>$_POST['interrupcao'][$i]</td>";
Here’s a snippet of what I’m trying to show you:
$html .= "<table>";
$html .= "<tr>";
$html .= "<th>INTERRUPÇÕES</th>";
$html .= "<th>Início</th>";
$html .= "<th>Término</th>";
$html .= "</tr>";
$teste = $_POST['interrupcao'];
for ($i=0; $i < count($teste); $i++) {
$html .="<td>$_POST['interrupcao'][$i]</td>";
$html .="<td>$_POST['inicioint'][$i]</td>";
$html .="<td>$_POST['terminoint'][$i]</td>";
}
$html .= "<tr>";
$html .= "</tr>";
$html .= "</table>";
Thanks =). But now the error has changed kkkk
– Matheus Martins
probably $test is an empty variable
– Rafael Mena Barreto
$test was like $test = $_POST['interruption'];. And I put the $test inside the for. Now I switched to: for ($i=0; $i < sizeof($_POST['interruption']); $i++) {. And it still didn’t work. The error is this: https://jpst.it/17cdH
– Matheus Martins
Then the problem has changed. I don’t use dompdf but the step-by-step to solve this is true for all tools that convert html to pdf. Make sure the html generated by php is correct.
– Rafael Mena Barreto
Okay, thank you =)
– Matheus Martins