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
  • 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. :)

Building an interactive eFuture classroom

Watch and learn how ATEN provided a total control system solution including seamless switching matrix switch, HDBaseT extenders, PDU, lighting control to build an interactive eFuture classroom.


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

Create the perfect environment for any meeting

You might have a modern environment with all sorts of high-tech equipment, but what makes it worthwhile is how you seamlessly bring together the presentation with audio, video and lighting. The ATEN Control System provides integrated control and system automation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Coldfusion Datefield problem 2 124
Systems talking to each other 5 146
spamming  on Hosted svrs? 6 103
How code a 301 redirect for folder files -> 1 file 2 73
A web service ( is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
What You Need to Know when Searching for a Webhost Provider
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

713 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