0

I have made a website in HTML and CSS, then I have used this code to convert it to pdf:

<?php

include("mpdf/mpdf.php");

$mpdf=new mPDF('c','A4','','' , 0 , 0 , 0 , 0 , 0 , 0); 
$mpdf->SetDisplayMode('fullpage');

$mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the
first level of a list

$mpdf->WriteHTML(file_get_contents('myhtmlcssfile.php'));
$mpdf->Output();

?>

Everything is fine, it's converting the .php file very well, until I use this function:

<?php echo $_POST["something"]; ?>

Where "something" is a field from form.
So it isn't printing what POST method is sent, only php code.
What am I doing wrong?

1 Answer 1

2

I've found that when you use the "File Get Contents" command it only READS the file, it does not EXECUTE the file. You will need to actually code your HTML into the page.

 $mpdf->WriteHTML('put your page code here.'.$put your $_POST["something"] values here.' Continue page code.');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.