Mr Jonas
Mr Jonas

Reputation: 1

Output input text to pdf file

Im using FPDF and FPDI libraries to edit pdf file. I created html text and submit input. I would like to take text input from html code and output it into pdf file. This is my code: HTML:

<form action="send.php" method="post">
<input type="text" name="post_text" id="post_text">
<input type="submit" value="send">
</form>

PHP:

..
$text = $_POST['post_text'];
...

$pdf->Write(0,'$text');
...

Then I write anything like hello, this is me in the textbox and I'm getting $text value output to my pdf. But I want that output to be the text written in textbox?

Upvotes: 0

Views: 1686

Answers (2)

user123
user123

Reputation: 5407

You are assigning constant string value to PDF write,

$pdf->Write(0, '$text');

it takes $text as a string.

try with:

$pdf->Write(0, $text);

It will write whatever content in $text onto pdf!

Upvotes: 0

user2629998
user2629998

Reputation:

You're printing $text as text, you don't need quotes if you want to print the variable contents.

$pdf->Write(0, $text);

Upvotes: 3

Related Questions