Simple subscribe form

need help can't figure out what i'm doing wrong

Page 1 of 1

3 Replies - 2124 Views - Last Post: 09 November 2007 - 12:50 PM Rate Topic: -----

#1 gmilazzo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 30-July 07

Simple subscribe form

Posted 30 July 2007 - 05:25 PM

<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 July 2007 - 05:26 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Simple subscribe form

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Simple subscribe form

Posted 04 August 2007 - 12:01 AM

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?

<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 :)

This post has been edited by PsychoCoder: 04 August 2007 - 12:19 AM

Was This Post Helpful? 0
  • +
  • -

#3 dswens  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 34
  • Joined: 16-October 07

Re: Simple subscribe form

Posted 17 October 2007 - 09:59 AM

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

<cfif IsDefined("Email_address")>
Was This Post Helpful? 0
  • +
  • -

#4 DeepH2O  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 7
  • Joined: 29-September 06

Re: Simple subscribe form

Posted 09 November 2007 - 12:50 PM

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

Happy coding.. :ph34r:

<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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1