Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


PDF file download ONLY when user provides appropriate info.

Posted on 2006-06-22
Medium Priority
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. :)

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.


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 2000 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : All lightning effects with instructions : http://www.mediaf…

722 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