PDF file download ONLY when user provides appropriate info.

Posted on 2006-06-22
Last Modified: 2013-12-24
Hey everyone

I have about 5 pdf files that we want users to be able to download. We would like to collect some contact information from them before they download the file.

Here is what I have been thinking: A user clicks on the "Take a Test" icon on our home page. The user then selects which test he/she wants to take. But before download, they are taken to a form where they provide us with some information. Only after all the required info is submitted should the user be able to actually download the pdf file or test.

Is there a way to do this without a database? Can someone help me out?


Question by:IShiva
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2

Expert Comment

ID: 16959450
You could use cfmail and have the form information emailed to you instead of storing it in a database.

You would still be able to use some form of validation to make sure that they give you the information you want, before taking them to the the page.  
Part of the form would be the list of test, you would need to hardcode in the values so that on the form process / email page you know what link to provide the user to download.

Expert Comment

ID: 16959469
oops.  hit submit before I inteneded to

With only 5 pdf's this would not be a hard task to manage.

If you find that you are constantly changing the tests and adding / removing items from the pages, you will find that you may want to upgrade to a data driven solution instead.

Author Comment

ID: 16959523

I see where youre going with it. Could you start me out with some code?

So I will really only have 2 pages? The form page where the user fills out their info and selects lets say a radio button for the test they want to take. Then following submission, based on the form value for the certain test, they are then taken to a page to click the 'download your test now' link?

Im not too much of a coder but if you start me out, I can usually figure the rest out........usually. :)

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!


Expert Comment

ID: 16959584
I can,  it will take me a bit to get some time to put something together.  Check back later today

Author Comment

ID: 16959821
LVL 13

Accepted Solution

usachrisk1983 earned 500 total points
ID: 17022275
Your page would look like this:

<cfif not isDefined('form.testName') or trim(form.testName) is ''>
  <cfform name="frmCollectInformation" method="post">
   <cfinput type="radio" name="testName" value="test_1"> Test 1<br>
   <cfinput type="radio" name="testName" value="test_2"> Test 2<br>
   <cfinput type="radio" name="testName" value="test_3"> Test 3<br>
   Please Enter Your Name: <cfinput type="text" name="clientName" value="">


  <!--- You could put some business logic here, such as only continue if they have a name entered --->

  <cfset form.testName = lcase(form.testName)>

  <cfif form.testName is 'test_1'> <!--- Redirect User to File, or Mail it to them, whatever ---> </cfif>
  <cfif form.testName is 'test_2'> <!--- Redirect User to File, or Mail it to them, whatever ---> </cfif>
  <cfif form.testName is 'test_3'> <!--- Redirect User to File, or Mail it to them, whatever ---> </cfif>

  <!--- You could do something here to store their name or whatever your collect --->

LVL 13

Expert Comment

ID: 17255761
IShiva, were you able to test my solution?

Author Comment

ID: 17263122
Yes, thanks usachrisk1983! Sorry I didnt respond sooner as I forgot. (Seems like I do that a lot here!! haha)

I appreciate the help!


Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question