I'm trying to create a pdf that receives data via POST,I know that the data is being received because i tested using "var_dump($_POST)".
Result:
array (size=9)
'orcCar' => string 'S' (length=1)
'contItem' =>
array (size=1)
0 => string '1' (length=1)
'codProduto' =>
array (size=1)
0 => string '000zxxxxxxx' (length=14)
'qtdProduto' =>
array (size=1)
0 => string '20' (length=2)
'prcuProduto' =>
array (size=1)
0 => string '4.28' (length=4)
'prctProduto' =>
array (size=1)
0 => string '85.60' (length=5)
'descProduto' =>
array (size=1)
0 => string 'sdsudhudud' (length=33)
'countNitens' => string '2' (length=1)
'codClientecopia' => string '' (length=0)
But when i try to use it in the middle of the html code or in a loop it wont work.
This is part of the code:
for($i=0; $i < count($_POST["codProduto"]); $i++)
{
if ($_POST["prcuProduto"][$i]=="")
{
$_POST["prcuProduto"][$i] = '0';
}
$contador=$_POST["contItem"][$i];
// Set some content to print
$html.="<tr>
<td style='width:5%;'><input type='number' name='contItem[]'
style='width:100%'id='contItem' readonly='readonly' value=".$contador."
maxlength='5'></td>
<td style='width:20%;'><input type='text' name='codProduto[]'
style='width:100%'id='codProduto' readonly='readonly' maxlength='20'
value=". $_POST['codProduto'][$i]."></td>";
}
// Print text using writeHTMLCell()
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);`enter code here`
It won't enter the loop because of
count($_POST["codProduto"])
when changed with value it works, but it still won't show any values or the "td".I also tried creating variables with the values from the post but it still didin't work.
Could someone help me how to use velues recived from post in tcpdf?