My client has a "resource" blog with articles and PDFs that are available for download.
They would like for their users to enter in an email address before being allowed to download the PDFs (I know). The form would save the entry into the database and email an admin the information for a possible follow-up (I know..). They would also like for the user's data to be saved for that session so they don't have to fill out the form over-and-over if they choose to download other articles. They do not want the user to have to login or register.
I have this working outside of ExpressionEngine2 and Freeform, using $_SESSION variables to check if the form was submitted and saving the $_POST data into the $_SESSION array for auto-populating the form fields on subsequent article pages. The user just has to hit Submit again on the form, which is fine.
However, when implementing in EE 2.7.3 using FreeForm Pro 4.1.3, using the default form action, the POST and SESSION arrays are empty after submission. If I substitute the Freeform form:action it works as expected, but of course the form results aren't stored in the database or emailed to the admin.
They love the Freeform interface and ability to see and export previous entries. Also, I need to do the form submission check server-side, so a user can't just view the source and download the PDF without filling out the form.
Is there another way to accomplish this? I am a hook novice. Any help or insight is most appreciated.
Here's my current code on the blog listing template: