The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages - More
> ColdFusion Development
|
New to ColdFusion [Forms]
Discuss New to ColdFusion [Forms] in the ColdFusion Development forum on Dev Shed. New to ColdFusion [Forms] ColdFusion Development forum discussing CFML coding practices, tips on CFML, and other CFML related topics. Find out why ColdFusion is the tool of choice for many e-commerce developers.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

April 13th, 2011, 08:27 PM
|
|
Registered User
|
|
Join Date: Apr 2011
Posts: 4
Time spent in forums: 37 m 8 sec
Reputation Power: 0
|
|
|
New to ColdFusion [Forms]
Hello,
I'm new to the forum and I noticed devshed had a coldfusion section,
I'm new to coldfusion and I want to learn,
I know <cfif>, <cfquery>, all that funky stuff
But I have a problem (Sure its easy but like I said I am new...)
I'm using forms to enter user-input data the form code looks like this
Code:
<form method="post" action="submit.cfm" name="submit">
<input type="text" name="name" />
<input type="text" name="email" />
<input type="submit" name="submit" value="Send" />
</form>
I basicly want to use <cfquery> to insert/update data but I don't know how to get the input from the form (name, email)
Any help?
Thank you in advance!
If I am not clear just let me know I'll try re-word 
|

April 13th, 2011, 10:12 PM
|
|
Moderator
|
|
Join Date: Jun 2002
Location: Raleigh, NC
|
|
The form fields posted in the form are available in the FORM scope.
Since you're new to CF, I really can't overemphasize the need to read the documentation, which explains all of this and more.
Welcome to CF-Land. 
|

April 13th, 2011, 10:18 PM
|
|
Registered User
|
|
Join Date: Apr 2011
Posts: 4
Time spent in forums: 37 m 8 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by kiteless The form fields posted in the form are available in the FORM scope.
Since you're new to CF, I really can't overemphasize the need to read the documentation, which explains all of thisand more.
Welcome to CF-Land.  |
Thank you for the link I shall read that! 
And thanks for the welcome.
|

April 14th, 2011, 11:36 AM
|
|
Registered User
|
|
Join Date: Apr 2011
Posts: 4
Time spent in forums: 37 m 8 sec
Reputation Power: 0
|
|
Sorry for the double post, But I got past the first part now I'm stuck again and didn't want to make a new thread
This is my code for "spam"
Code:
<cfquery name="MarkAsSpam" datasource="#DSN#">
UPDATE cms_comments
SET comment = '<i>Marked as spam by staff</i>'
WHERE id = '#form.id#'
</cfquery>
<cfquery name="PointMax" datasource="#DSN#">
SELECT *
FROM users
WHERE id = '#form.userid#'
</cfquery>
<cfif user.user_news_spam is 3>
<cfquery name="SetPoint3" datasource="#DSN#">
UPDATE users
SET user_news_spam = '3'
WHERE id = '#form.userid#'
</cfquery>
<cfelse>
<cfquery name="AddSpamPoint" datasource="#DSN#">
UPDATE users
SET user_news_spam = user_news_spam + 1
WHERE id = '#form.id#'
</cfquery>
</cfif>
When I submit and goto "spam.cfm" I get this error...
Code:
Element USER_NEWS_SPAM is undefined in USER.
Any help on this?
Much appreciated! 
|

April 14th, 2011, 03:08 PM
|
|
Moderator
|
|
Join Date: Jun 2002
Location: Raleigh, NC
|
|
You reference query columns using the query name. i.e. PointMax.USER_NEWS_SPAM.
Again, this is all explained completely in the documentation, as well as in any book on CF. The CF Web Application Construction Kit (WACK) is the unofficial bible on CF if you find the official docs too dry.
You'll find learning this a lot easier (and faster) if you go through the docs or read the book.
|

April 18th, 2011, 07:47 AM
|
|
Registered User
|
|
Join Date: Mar 2011
Posts: 27
Time spent in forums: 4 h 41 m 25 sec
Reputation Power: 0
|
|
You may also want to look up <cfqueryparam> tag while you're at it. Make good habits of using this tag in your query WHERE clauses 
|

April 18th, 2011, 08:20 AM
|
|
Registered User
|
|
Join Date: Apr 2011
Posts: 4
Time spent in forums: 37 m 8 sec
Reputation Power: 0
|
|
Oh OK,
I've seen them used but I never seen the point in them,
Ill have a look into it  can you give a brief on what it does?
|

April 18th, 2011, 08:31 AM
|
|
Moderator
|
|
Join Date: Jun 2002
Location: Raleigh, NC
|
|
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|