我正在使用PHP和外部库 NSCalendarMatchNextTime
和透明度脚本生成PDF: FPDF 。
代码:
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();
?>
答案 0 :(得分:2)
此
$name = $_POST['$name'];
应该是
$name = $_POST['name'];
尝试var_dump($_POST)
或print_r($_POST)
进行校对。
也尝试打印$_POST['$name']