Solved

CF - Multiple email form submit

Posted on 2011-03-15
6
329 Views
Last Modified: 2012-05-11
For some reason it has been requested that we have a email signup form that first comes up and asks for your email and after you click submit another form comes up asking for name, company etc.  How do I match up the first form submission with the second so the email submitted matches the name, company etc.

Any help is appreciated
0
Comment
Question by:JohnMac328
[X]
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
6 Comments
 
LVL 39

Expert Comment

by:gdemaria
ID: 35141279

Do you want to create a database record for the first page or only after successful submission of both pages?

If saving after each page...
Have the first form submit, save, get the Primary key from the table and pass it to the 2nd form

If saving only after 2nd page...
Have the first form submit to the 2nd page, store those fields in hidden form fields, on submit, save everything


The first method is probably the one you want, it allows you to get some information saved before asking for more.  If the user bails out on the 2nd page, at least you have their basic info.  

0
 

Author Comment

by:JohnMac328
ID: 35141324
Yes - I was thinking of something like the first example.  How do I pass the primary key to the 2nd form?
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 35141378

The first form can post to the second form if you like.  At the top of the form-2's file, just test for the submit action of form-1.   You save the data and then drop down the code to show the 2nd form, putting the ID into a hidden field.

Alternatively, you can pass it on the URL,  After saving the first form, just do a cflocation

<cflocation url="form2.cfm?Id=#theID#" addToken="no">

0
Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

 

Author Comment

by:JohnMac328
ID: 35141416
So after the first submit the email will be added with the ID of 400.  With cflocation the remaining data will be entered also under the ID of 400?
0
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 total points
ID: 35141494

 AFter the first submit, the email will be added (inserted, I assume?)
 Get the ID from the newly created record
 Pass the ID to the other form with CFLOCATION

 Now on 2nd form, ask for the information you want
 On submit, update the table using ID=#url.ID#


-------------------------------------------------------------------------
First Form..


  if submit then
     save email
     get ID
     cflocaton form2.cfm?ID=#getID#
  end if

 The Form (submit page to itself)
  What is your Email address [       ]
  [Submit button]




Second Form

  if submit then  
     update record where ID = #url.id#
     cflocation url="goSomewhereElse.cfm"
  end if

 
 The Form (submit page to itself)
   What is your name, phone, etc?
   [Submit button]
0
 

Author Closing Comment

by:JohnMac328
ID: 35141522
That should work.

Thanks
0

Featured Post

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

717 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