You need to scope your variables..

<cfparam name="form.name" default="" />
<cfparam name="form.email" default="" />
<cfparam name="form.emailType" default="0" />



On Fri, Jul 11, 2008 at 10:08 PM, John Barrett <[EMAIL PROTECTED]> wrote:
> Hi Paul,
> Thanks so much for your help:)
> I am back at school now, and I finally figured this out`-`
>
> I gave up on the tutorial, as I could not get it to work, tried to change the 
> db field name, the database, the datasource you name it!
>
> Basically what I was trying to do is to check if the email is already in the 
> db(for a newsletter), and if so give a message, if not add the user.
>
> I am now trying to figure out if the user does not enter anything, to deal 
> with that.
> I tried <cfparam name="Name" default=""> but no love.
>
> Here is my code, is this good practice for this type of app? I am going to 
> try to get everything on one page so the user can re-enter the info(if 
> already taken), otherwise I think that I will need to use sessions to 
> remember the info on the action page.
> Thanks so much for all your help!
> John
> <!---form.cfm--->
>     <cfform action="form_action.cfm" method="post">
>       Name: <cfinput type="Text" Name="Name"><br />
>       Email: <cfinput type="text" name="Email"><br />
>       Receive in: Text <cfinput type="radio" name="EmailType" value="1">
>                   HTML <cfinput type="radio" name="EmailType" checked="true" 
> value="0">
>       <cfinput type="Submit" name="SubmitForm" value="Submit">
>     </cfform>
>
> <!---form_action.cfm--->
> <cfparam name="Name" default="">
> <cfparam name="Email" default="">
> <cfparam name="EmailType" default="0">
>    <cfquery name="DupCheck" datasource="#REQUEST.dataSource#">
>        SELECT *
>        FROM Newsletter
>        WHERE email = <cfqueryparam cfsqltype="cf_sql_varchar" 
> value="#Form.email#" />
>    </cfquery>
> <!--- If our query shows a email match than using recordCount we can tell the 
> user that his email address already exists in our database --->
> <cfif DupCheck.recordCount GT "0">
>   You are already Listed in our Mailing List!
>   <!--- If our recordCount is not greater than "0" we continue on and process 
> the new email address --->
> <cfelse>
>     <!--- Insert Member Information Into Database --->
>     <cfinsert datasource="#REQUEST.dataSource#" tablename="Newsletter" 
> formfields="Name, Email, EmailType">
>     <cfoutput>
>       Thank you #Name#,<br />
>       Your email address [#Email#] Has been entered into our mailing list. 
> You'll receive the next mailing!
>     </cfoutput>
> </cfif>
>
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3816
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to