Integrate Email sign up function into existing web contact form


Integrate Email sign up function into existing web contact form

I have a form that web visitors may use to send comments, that sends an email to the site owner. How do I incorporate the sign up function into this form that allows both things - a customer to send me a comment and also add their email address to my CC list if they check a box on the form before clicking submit?


Thank you!




What you would want to do is have the submit button store everything in to the $_POST and then have another page or even that page check for the existing variables.  For example if your using PHP:


  // Add to constant contact
// Send comment

 A sample of what our PHP library can do can also be found here.


Let me know if this helps.

Ryan Davis
Quality Engineer

Thanks for your response. I'm still in need of some help. I've looked at all of the sample code. The piece that's missing for me is the action. I'm not sure how to process the form, have a contact be added to the list and still allow the comments field to submit an email to the site owner.


Is there anything more specific you can offer?


Many thanks again.

What Ryan was suggesting is adding the checkbox to set a param to true/false on the post back to your server.  When the post request is received sending you the form informaiton, check the value of the checkbox for newsletter signup.


If it is false, don't do anything.


If it's true, you would add a call to another PHP script that would create/update the Contact in Constant Contact. 


Regardless of the value of this parameter, you'd still do the exact same logic for the comment piece.  This would just be an additional if() statement to check to see if the param is true and if it is, make a request to add the Contact through additional PHP code or, my recommendation would be this option, a seperate PHP file that just adds/updates their Contact information.  You could use our sample PHP code to help you get this done quickly. 

Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

View API documentation, code samples, get your API key.

Visit Page