Campaign Sample Forms in PHP Managing Email Campaigns


This page is intended to help users use the PHP Upload Form sample application.



1. Create a New Campaign


Users can create a new Campaign by filling out the form. They can provide the following informations for the new Campaign: Campaign Name, Subject, From Name, From Email Address, Reply Email Address, Permission Reminder, Webpage Version, Tex, Link Text, Greeting, Organization Name, Address 1 - 3, City, State, Zip/Postal Code, Country, Forward Email to a Friend (Added to your email and Added to the forwarded emails), EMAIL BODY: HTML/XHTML VERSION, EMAIL BODY: TEXT VERSION, EMAIL BODY: STYLE SHEET (for XHTML VERSION) and List Selection on which the Campaign would be sent to.

Required fields are: Campaign Name, Subject, From Name, From Email Address, Reply Email Address, Organization Name, Address 1, City, State (for United States), Zip/Postal Code, EMAIL BODY: HTML/XHTML VERSION, EMAIL BODY: TEXT VERSION and at least one item selected from the right list.



2. List All Campaigns


List all Campaigns option will display all campaigns added by user. A campaign can be edited clicking on the Edit link. The Remove link will delete the campign. Since the Constant Contact REST API uses chunk data, this page also displayes information using chunks (50 campaigns on page). The Next link will perform another query that will retrieve from the Constant Contact server the next 50 campaigns. If you press it again it will display the next 50 campaigns. If there are no other campaigns, the link will be automaticaly disabled. The First Page link will get the first 50 campaigns from the server.


3. Search Campaigns


Search Campaigns section displays only the campaigns with the selected status. The available statuses are: Sent, Draft, Running and Scheduled. See All option is equivalent to List All Campaigns

4. Edit a Campaign


The Edit Campaign section allows the user to edit a campaign. The fields are the same like those used to create a campaign and display the information added before.

A campaign can only be updated in DRAFT status.


5. Remove a Campaign


A campaign can be deleted from the list by clicking Delete button and thus will be excluded from overall statistics.


6. Campaign Events Report


The Campaign Events Report displays a range of information on a specific campaign like how many times has been sent, how many times has been opened, the number of clicks, the number of forwards, spam reports, etc.

Only the campaigns which have already been sent may have an Evaints Report.


7. Debugging


If $sent_recived_debug variable is set true, the user will be able to see the XML which has been sent to the server after submitting the form and the reply received from the server.


8. How-To use it


This PHP SAMPLE APPLICATION consists of the following files:

  • class CC_Utility - This class contains API Key, Username and Password used to acces Constant resources. Also, it contains definition for State/Province and Country.
  • [BaseFolder]\images - [DIR] - This directory contains all relevant images included in this sample.
  • [BaseFolder]\countries.txt - [FILE] - This text file contains the list with all countries available in ConstantContact. Each country is on a separate line, together with its country code.
  • [BaseFolder]\states.txt - [FILE] - This text file contains the list with all states available in ConstantContact. With this lines are populated comboboxes in our sample application.
  • [BaseFolder]\txt\PermissionReminder.txt - [FILE] - This file contains the default permission reminder text.
  • [BaseFolder]\txt\EmailContent.txt - [FILE] - This text file contains the default email content body.
  • [BaseFolder]\css\style.css - [FILE] - StyleSheet used to beautify our Sample Application.
  • [BaseFolder]\js - [DIR] - JavaScripts used to redirect the user to `List All Campaigns` after adding a new campaign.
  • [BaseFolder]\cc_class.php - CC_Utility, CC_List, CC_Contact and CC_Campaign API classes. CC_Utility is used for connecting to API and processing server calls as well as generating state fields. CC_Contact extends CC_Utility and is used for ConstantConact CRUD management. CC_Campaign extends CC_Utility and is used for ConstantCampaign CRUD management. CC_List extends CC_Utility and used for retrieving all the Email Lists from ConstantContact and all Registered Email Addresses.
  • [BaseFolder]\header.php - File with a basic design for header. It contains the image and menu navigation which is included in all forms within the sample application.
  • [BaseFolder]\index.php - default file for this sample application.
  • [BaseFolder]\list_campaigns.php - Php file which is designed to display all the campaigns for current account or only the campaigns whose status was selected.
  • [BaseFolder]\delete_campaign.php - File that is executed when user click on REMOVE link from `LIST ALL CAMPAIGNS` or `SEARCH CAMPAIGNS`.
  • [BaseFolder]\edit_campaign.php - Php file that is designed to add or edit a campaign. When editing, the user can modify ALL the available fields.
  • [BaseFolder]\campaign_events.php - Php file that is designed to display additional information about a campaign which has been sent.

Community Knowledge Base

Learning & Resources

We take questions asked by customers on the Community and expand on them to help you find answers fast, getting you back to using Constant Contact's suite of amazing tools in no time.

Read More

  • Avatar

    Support Tips

    Social Media

    "There's a multitude of ways to engage your audience through us using your social platforms - via ads, social post metrics, email links, and more! " - Will

    See Article
  • Avatar

    Support Tips

    Call-To-Action Links

    "Target your most engaged contacts by creating a segment. Create a special offer or show your appreciation!" - Caitlin

    See Article
  • Avatar

    Support Tips

    Welcome Your Audience

    "Greet new contacts with one or more automated Welcome Emails depending on their interests or your business goals." - Nick

    See Article