Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Insert Into DB & Sendmail

Explorer ,
Feb 15, 2011 Feb 15, 2011

BACKGROUND: I had developed a form that when submitted goes to a page to process the formmail.  This works great. The process goes like this (using cflocation each time):

registration 1 > send regisitration 1 > registration 2 > send registration 2 > registration complete.

So, I receive 2 seperate emails for each step of the registration process.

WHAT I WOULD LIKE TO DO: So now, I want to be able to take some of the fields and when the form is submitted to the formmail processing page, to also inter it into a database.  So in DW, I added 'insert form'.  The fileds in the DB are the same as the names of the form fields.  When tested, if the cflocation is pointed to any page other than one of the formmail processors, the data is successfully uploaded to the DB.  However, if the cflocation goes to 'send registration 1', the info is uploaded to the DB, BUT then the webpage shows a "page cannot be found" error, with no CF error information.

Is it possible to do both tasks without having to change my code too much?

590
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Feb 15, 2011 Feb 15, 2011

You could store all your form variables as session variables as you go along.  One thing you'll have to decide is whether to validate the submitted values after each submission, or at the end.  Personally, I'd do it after each page submission, but then again, I'd probably have one big form rather than 4 little ones.

Translate
LEGEND ,
Feb 15, 2011 Feb 15, 2011

Your exisitng code might be more complicated than necessary with all those cflocations you pointed out.  It's possible to insert your record, send mail, and display feedback all on one page.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 15, 2011 Feb 15, 2011

Cool. Though I want to avoid rewriting t all the pages for now. i will

look into this matter later on down the road. So, it it possible to have 4

different redistration pages and at the end submit everything to both email

and DB? I am trying to avoid having one HUGE form on one page.

See URLs:

http://urbanswimandfitness.com/register.cfm

http://urbanswimandfitness.com/regStep2.cfm

http://urbanswimandfitness.com/regStep3.cfm

http://urbanswimandfitness.com/regStep4.cfm

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 15, 2011 Feb 15, 2011

You could store all your form variables as session variables as you go along.  One thing you'll have to decide is whether to validate the submitted values after each submission, or at the end.  Personally, I'd do it after each page submission, but then again, I'd probably have one big form rather than 4 little ones.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 15, 2011 Feb 15, 2011
LATEST

Intriguing. I will see if my client would be willing to do a long form. I

can shorten it with jquery tips. What are the steps to combine both DB

insertion and formmail into one page?

BTW, if I do this, I will want to submit to two seperate DBs.

Thanks in advance.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources