0
HTML 양식의 데이터를 PDF 문서로 쓰고 싶습니다.HTML 양식에서 pdf로 데이터 제출
(home.php)
<!doctype HTML>
<html>
<body>
<form action="test.php" method="post">
NAME:<input type="text" name="name" ><br><br>
E-mail:<input type="text" name="email"><br><br>
Submit:<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
<?php
if(isset($_POST['submit'])){
if(empty($_POST['name'])){
echo "fill"."<br><br>";
}
if(empty($_POST['email'])){
if(empty($_POST['name'])){
echo "check";
}
}
}
?>
(test.php)
<?php
require('fpdf.php');
class PDF extends FPDF {
function Header() {
$this->SetFont('Helvetica','B',15);
$this->SetXY(50, 10);
$this->Cell(0,10,'This is a header',1,0,'C');
}
function content() {
$html = '<table>
<tr>
<td>'.$_POST['name'].'</td>
</tr>
<tr>
<td>'.$_POST['email'].'</td>
</tr>
</table> ';
$this->write($html);
}
function Footer() {
$this->SetXY(100,-15);
$this->SetFont('Helvetica','I',10);
$this->Write (5, 'This is a footer');
}
}
$pdf=new PDF();
$pdf->AddPage();
$pdf->Output();
?>
문제 나 질문이있다 : 여기 내 코드는? –
문제는 입니다. 데이터를 PDF로 저장할 수 없습니다 –
이것을 수행하려고하면 어떤 오류가 발생합니까? – APerson