Welcome to Dream.In.Code
Getting Help is Easy!

Join 105,772 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,326 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Simple subscribe form

 
Reply to this topicStart new topic

Simple subscribe form, need help can't figure out what i'm doing wrong

gmilazzo
post 30 Jul, 2007 - 05:25 PM
Post #1


New D.I.C Head

*
Joined: 30 Jul, 2007
Posts: 1


My Contributions


<cfif IsDefined("Email")>

<cfinsert datasource="USAmailing" tablename="USA" formfields="First_Name, Last_Name, Email_address, Company_Name">

<cfoutput>
Thank you #First_Name#
Your email address [#Email_Address#] Has been enter into our mailing list. You'll recieve the next mailing!
</cfoutput>

<cfelse>
<fORM ACTION="subscribe.CFM" METHOD="POST">
First Name: <input type="text" name="First_Name"><br>
Last Name: <input type="text" name="Last_Name"><br>
Company Name: <input type="text" name="Company_Name"><br>
Email Address: <input type="text" name="Email_Address">

<input type="submit" value="Join Newsletter">



</fORM>
</cfif>

It just clears the page never enter anything into the database or any thing what am i missing

This post has been edited by gmilazzo: 30 Jul, 2007 - 05:26 PM
User is offlineProfile CardPM

Go to the top of the page


PsychoCoder
post 4 Aug, 2007 - 12:01 AM
Post #2


DIC.Rules == true;

Group Icon
Joined: 26 Jul, 2007
Posts: 7,031



Thanked 47 times

Dream Kudos: 7600

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, GDI

My Contributions


Have you double checked that your DataSource USAmailing has all the correct information for connecting to your database?

Maybe there is a hidden problem with your <cfinput> tag, have you tried it in a <cfquery> tag to check your ODBC connection?

CODE

<cfquery name="AddMailing" datasource="USAmailing">
    INSERT INTO USA
    VALUES ('#Form.First_Name#', '#Form.Last_Name#', '#Form.Email_Address_ID#','#Form.Company_Name#')
</cfquery>


You can try the <cfquery> to see if this works. If not I'm really thinking its your ODBC connection to your database.

Hope this helps smile.gif

This post has been edited by PsychoCoder: 4 Aug, 2007 - 12:19 AM
User is online!Profile CardPM

Go to the top of the page

dswens
post 17 Oct, 2007 - 09:59 AM
Post #3


New D.I.C Head

*
Joined: 16 Oct, 2007
Posts: 34


My Contributions


Try this: Change your CFIF Statement. It looks like your variable name is wrong.

<cfif IsDefined("Email_address")>

User is offlineProfile CardPM

Go to the top of the page

DeepH2O
post 9 Nov, 2007 - 12:50 PM
Post #4


New D.I.C Head

*
Joined: 29 Sep, 2006
Posts: 7


My Contributions


Try something like this, I am assuming the form is posting back to itself in this case based on your logic.

Happy coding.. ph34r.gif

<cfparam name="form.cmdsubmit" default="">
<cfparam name="form.email_address" default="">

<!---// check to see if the form is being submitted //--->
<cfif form.cmdsubmit EQ "join newsletter")>

<!---// now check the to see if the field exists //--->
<cfif isDefined("form.email_address")>

<cfinsert datasource="USAmailing" tablename="USA" formfields="First_Name, Last_Name, Email_address, Company_Name">

<cfoutput>
Thank you #form.First_Name#
Your email address [#form.Email_Address#] Has been enter into our mailing list. You'll recieve the next mailing!
</cfoutput>
</cfif>
<cfelse>
<fORM ACTION="subscribe.CFM" METHOD="POST">
First Name: <input type="text" name="First_Name"><br>
Last Name: <input type="text" name="Last_Name"><br>
Company Name: <input type="text" name="Company_Name"><br>
Email Address: <input type="text" name="Email_Address">

<!---// add the NAME to the control so you can test for the submit value when posting the form //--->
<input name="cmdsubmit" type="submit" value="Join Newsletter">



</fORM>
</cfif>

~Programmers maxim~
Just when you think you have idiot-proofed something, along comes a better idiot.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 8/21/08 04:02PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month