Solved

CF - Multiple email form submit

Posted on 2011-03-15
6
315 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
  • 3
  • 3
6 Comments
 
LVL 39

Expert Comment

by:gdemaria
Comment Utility

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
Comment Utility
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
Comment Utility

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
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 

Author Comment

by:JohnMac328
Comment Utility
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
Comment Utility

 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
Comment Utility
That should work.

Thanks
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now