I have the following code for checkboxes in html:
<label>Choose type of order :</label>
<input type="checkbox" name="check_list[]" value="to1" > Energy Bar<br>
<input type="checkbox" name="check_list[]" value="to2"> Tents <br>
<input type="checkbox" name="check_list[]" value="to3"> Canned foods <br>
</p>
And the php code is :
<?php
$t01=$_POST['check_list'][];
require("fpdf.php");
$pdf = new FPDF();
$pdf->AddPage();
foreach($_POST['check_list'] as $check) {
echo $check;
$pdf->Cell(50,10,"Total order :",1,0);
$pdf->Cell(50,10,"$t01",1,1);
}
}
$pdf->Output();
}
?>
However when I run this on my server it shows me the following error:
Fatal error: Cannot use [] for reading in /Applications/XAMPP/xamppfiles/htdocs/demo/form.php on line 11
How can I correct this problem
Aucun commentaire:
Enregistrer un commentaire