
Tabla html dentro de variable PHP
Publicado por Victor (195 intervenciones) el 26/01/2015 14:21:14
Buenas tengo esta tabla html dentro una variable php
Y todo va bien hasta que llega a celdas en las que no hay datos entonces se me pinta el codigo html y queda como la imagen de la foto que adjunto,como lo evito?
Saludos.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php $tablaOrigenPdf.='<table id="cuadriculaMovSilos" name="cuadriculaMovSilos"
style="width: auto;border: 0px;margin-top:0px;border-style: none;">
<thead>
<tr style="border-style: none;">
<th>Sala</th>
<th style="width: 100px;"\>Cantidad</th>
<th>Tipo</th>
<th>Fecha</th>
</tr>
</thead>';
for($i=0;$i<count($movSilo);$i++)
{
$tablaOrigenPdf.='<tr>
<td style="border: none">
<input type="text" name="Sala" value='.$movSilo[$i]['Sala'].'
style=text-align: center;/>
</td>
<td style="border: none">
<input type="text" name="peso" value='.$movSilo[$i]['Cuantia'].'
style="text-align:center;"/>
</td>
<td style="border: none">
<input type="text" name="tipo" value='.$movSilo[$i]['Tipo'].'
style="text-align:center;"/>
</td>
<td style="border: none">
<input type="text" name="fechaEntrada" value='.$movSilo[$i]['Fecha de Entrada'].'
style="text-align: center;"/>
</td>
</tr>';?>
<?php
}
$tablaOrigenPdf.='</table>';
echo $tablaOrigenPdf;
Y todo va bien hasta que llega a celdas en las que no hay datos entonces se me pinta el codigo html y queda como la imagen de la foto que adjunto,como lo evito?
Saludos.
- TablaPHP.zip(175,7 KB)
Valora esta pregunta


0