Richard Cripps
Richard Cripps

Reputation: 193

Pass PHP values into mPDF

I have recently started using mPDF and have been able to create a PDF using the HTML tags it offers to you. However, if, for example, you wanted to create an invoice and needed to pass through an attribute to fill in relevant fields like gross weekly expense etc is that possible? So for example:

$foo = bar; $html = '

Lorum Ipsem <.?php echo '$foo';></php>

Donec mauris....

';


I'm aware there is probably a simple explanation for this but because of the lack of documentation in general for this problem I'm struggling to resolve it. Thank you in advance for any help.

Upvotes: 0

Views: 595

Answers (2)

LefterisL
LefterisL

Reputation: 1143

$html = '

Lorum Ipsem '.$foo.'

Donec mauris....';

Upvotes: 0

Sam
Sam

Reputation: 20486

$html = '

Lorum Ipsem ' . $foo . '

Donec mauris....

';

OR

$html = "

Lorum Ipsem $foo

Donec mauris....

";

PHP Strings are concatenated with .'s or you can parse variable values directly in Strings if you use double-quotes. See the linked documentation for more information.

Upvotes: 2

Related Questions