EasyCFM.COM ColdFusion Forums / ColdFusion Applications / Capturing Form Data

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Capturing Form Data

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

pbrooks252
08-22-2007 @ 11:38 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 1
Joined: Aug 2007

I am very new to Macromedia Coldfusion, I have a user registration form and would like to capture / store & for debugging purposes echo (print) the form data using a CFscript. The form’s name is Registration one of the text fields name is FirstName. I am having a problem referencing the value entered into the field. My reference is as follows ……. Registration.FirstName but it isn’t recognized what is the correct way to reference form data. Does anyone have a colfusion script to capture, store and print form data and a query  to store it in MySql.

dlackey
08-22-2007 @ 12:03 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 935
Joined: Jun 2007

@pbrooks252

Hi there and welcome to the forum.  Not sure if you knew there but this site is LOADED with tutorials.  http://www.easycfm.com/tutorials/index.cfm?dirView=True.  Being new, there are a lot of things you need to know that can be overlooked or assumed which might make your learning CF frustrating without having a solid foundation; the tutorials will help in this regard.  That said...

In regards to your question though, on your action page, you could simply do a:

<cfoutput>
#form.firstname#<br />
#form.lastname#<br />
#form.phone#<br />
#form.address1#<br />
#form.city#<br />
#form.state#<br />
#form.zip#<br />
#form.email#<br />
</cfoutput>

which will display the submitted value for FirstName (along with any other variables you want to print).  

Regarding the insert, I cannot help you with that as I do not know the syntax to use for MySQL, I use Microsoft SQL (msSQL).

Cheers,
Chip

This message was edited by dlackey on 8-22-07 @ 12:03 PM

jarottman
08-24-2007 @ 7:59 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 679
Joined: Sep 2004

Adding to dlackey's post you can use something like this.


<cfquery datasource="dsn">
     INSERT INTO
          myTable
          (fName, lName, tName)
     VALUES
          ('#form.firstName#','#form.lastName#', '#form.thisName#')
</cfquery>

<cfquery datasource="dsn">
     UPDATE
          myTable
     SET
          fName = '#form.firstName#',
          lName = '#form.lastName#',
          tName = '#form.thisName#'
     WHERE
          nameUUID = '#form.nameID#'
</cfquery>




cflock of seagulls?


Website Designed and Developed by Pablo Varando.