So I’m using WordPress and have the plugin “Contact Form 7″ installed. What I was looking to do was create a way for a form to be filled out on the site, and when they press submit it will convert their posted data into a PDF with some text around it and email it.

So far, I have installed fPDF and been able to create a PDF that attaches to the email when you press “submit”. However, I have not been able to get it to show and of the results from the form submission within the PDF. I’m an amateur with PHP so I think with a few syntax changes and some help I should be able to get it going in no time. Here’s what I’ve done so far:

In my functions.php file I added this code:

Which will send me an email with a PDF that has the code written on it on line 10 : “Hello, World! Is there anything below this?”

Based on a post from the WordPress support page here:

The guy says to also add the code below to be able to get your values to show:

$values = $cf7->posted_data;
echo $values['your-value'];

I’ve tried about 50 combinations of this, but the data isn’t even being sent. I keep getting an error at the bottom of the form that says:
json.parse unexpected character at line 1 column 1 of the json data

I’ve tried (based on reading fPDF’s documentation), to write the posted data, but I can’t seem to figure out this part.

Just a few items I have in my contact form are: month, day of the month, year, and company, and i’ve tried to incorporate variations to get it to “echo” into the PDF.

echo $values['month'];
echo $values['daymonth'];
echo $values['year'];
echo $values['company'];

Again, I’m not very fluent in PHP, so any advice or feedback would be greatly appreciated!

Read more here: fPDF and Contact form 7 - exporting form results to PDF


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , , ,

Wordpress related questions and answers: