I'm showing the result of a search in a PHP file. However when trying to display the data when generating the pdf document, this does not, does not recognize the variables, how could I do it? I am using the structure of an HTML. Currently generating some errors when trying to pass the file to PDF, the errors shown are syntax errors
<?php
require_once APPPATH. '/third_party/dompdf/autoload.inc.php';
use Dompdf\Dompdf;
$html ='<html>
<head>
<title>Porcentaje de Cias</title>
</head>
<body>
<h2 style="text-align:center;">Porcentaje de Citas</h2>
<br></br>
<br></br>
<div>
<label>Fecha de Inicio:<?php echo $_GET['fecha_ini']; ?></label>
</div>
<div>
<label>Fecha de termino: <?php echo $_GET['fecha_ter']; ?></label>
</div>
<div>
<label>Jefe de Carrera: <?php echo $_GET['jc']; ?></label>
</div>
<br></br>
<br></br>
<br></br>
<div>
<img src=".img/logo-aiep.png">
<div>
<br></br>
<div style="top: -100px;">
<table style="border:1px solid red;width:100%;">
<tr>
<th style="text-align:center;">Motivo</th>
<th style="text-align:center;">Cantidad</th>
<th style="text-align:center;">Porcentaje</th>
</tr>
<?php
foreach($consulta as $row)
{?>
<tr>
<td style="text-align:center;"><?php echo $row->descripcion_mot ;?></td>
<td style="text-align:center;"><?php echo $row->cantidad_motivos ;?></td>
<td style="text-align:center;"><?php echo $row->porcentaje ; echo '%'?></td>
</tr>
<?php }?>
<tr>
<td style="text-align:center;">Totales</td>
<td style="text-align:center;"><?php foreach($total as $row){ echo $row->total; } ?></td>
<td style="text-align:center;">100 % </td>
</tr>
</table>
<div>
</body>
</html>
';
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("Porcentaje de Citas.pdf", array("Attachment" => false));
exit(0);
?>