Hi Greg,
I am sorry, but I did use what you said, but I did not keep the  
"form" in the cfinsert part, because that gave me the error" String  
index out of range: -2"
I have never been able to figure out how to  figure out how to write  
nothing(a blank field) to a database incase a user just submits the  
form without entering any data.
In the cfinsert I have tried "form.name" #form.name#" "'#form.name#'"  
but I always get the same error??
Thanks so much,
John
Below is my code.

<!---form--->
<cfform action="actionpage.cfm" method="post">
   <table width="311" border="0">
     <tr>
       <td>Name</td>
       <td><cfinput type="Text" Name="name"></td>
     </tr>
     <tr>
       <td>Email</td>
       <td><cfinput type="text" name="email"></td>
     </tr>
     <tr>
       <td>Receive in</td>
       <td>Text <cfinput type="radio" name="EmailType" value="1">HTML  
<cfinput type="radio" name="emailType" checked="true" value="0"></td>
     </tr>
     <tr>
       <td></td>
       <td><cfinput type="Submit" name="SubmitForm"  
value="subscribe"></td>
     </tr>
   </table>
</cfform>
<!---actionpage--->
<cfparam name="form.name" default="" />
<cfparam name="form.email" default="" />
<cfparam name="form.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="'#form.name#', '#form.email#',  
'#form.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:3820
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