ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 13th, 2011, 08:27 PM
Late3 Late3 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2011
Posts: 4 Late3 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #2  
Old April 13th, 2011, 10:12 PM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
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.

Reply With Quote
  #3  
Old April 13th, 2011, 10:18 PM
Late3 Late3 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2011
Posts: 4 Late3 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
  #4  
Old April 14th, 2011, 11:36 AM
Late3 Late3 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2011
Posts: 4 Late3 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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!

Reply With Quote
  #5  
Old April 14th, 2011, 03:08 PM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
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.

Reply With Quote
  #6  
Old April 18th, 2011, 07:47 AM
BowlerDo0d BowlerDo0d is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2011
Posts: 27 BowlerDo0d User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #7  
Old April 18th, 2011, 08:20 AM
Late3 Late3 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2011
Posts: 4 Late3 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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?

Reply With Quote
  #8  
Old April 18th, 2011, 08:31 AM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
It forces the query to use bind variables: http://help.adobe.com/en_US/ColdFus...22c24-7c36.html

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > New to ColdFusion [Forms]

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap