1
我正在使用PHP和外部库生成PDF FPDF和透明度脚本:alphapdf。如何在使用FPDF生成的PDF上编写_POST变量数据?
代码:
HTML
<form name="myform" method="POST" target="_blank">
<button type="submit" formaction="print.php"> Print </button>
<input type ="text" name="name"></input>
</form>
PHP
<?php
require('alpha/alphapdf.php');
// Instanciation of inherited class
$pdf = new AlphaPDF();
$pdf->AddPage();
$pdf->SetLineWidth(1.5);
// draw jpeg image
$pdf->Image('my-image.jpg',0,0,220,300,'JPG');
// print name
$pdf->SetFont('Arial', '', 12);
$name = $_POST['$name'];
$pdf->Text(10,28,$name);
$pdf -> Output();
?>
那么你在pdf中得到什么? echo $ _POST ['name'],看看你收到了什么。 – WeAreRight
我做了echo和print_r以及数据确实发布了,但是问题在于分配给变量,通过下面的答案得到解决谢谢:) –