Skip to main content
Known Participant
February 15, 2011
Answered

Insert Into DB & Sendmail

  • February 15, 2011
  • 1 reply
  • 726 views

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?

    This topic has been closed for replies.
    Correct answer Dan_Bracuk

    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.

    1 reply

    Inspiring
    February 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.

    OgreOneAuthor
    Known Participant
    February 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

    Dan_BracukCorrect answer
    Inspiring
    February 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.