JohnMac328
asked on
CF - Multiple email form submit
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
Any help is appreciated
ASKER
Yes - I was thinking of something like the first example. How do I pass the primary key to the 2nd form?
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#"
ASKER
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That should work.
Thanks
Thanks
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.