We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

Useing PHP sample code to create a custom email signup form on website


Useing PHP sample code to create a custom email signup form on website


I am trying to modify the php api sample code (file name simple_form.php)

However what I want is on my website to just have a form that collects the users first name, last name and email address. I want to use an api call because I need the info also added to a local mysql database for login to a vip section.

Anyway anytime I make all the fields hidden in the sample php file I get a error occured error message when testing the form submit.

It seems to be in relation to making the email lists list check boxes hidden.

I am attaching the file I am editing so you all can take a look and advise me

So any suggestions?




I think the issue you are having is the $postFields value that you are using. Currently, line 27 of your example is listed as:

$postFields = '11';


However, this is required to be an array of list ID's. If you were just wanting the contacts to be automatically subscribed to list id 11, you would want to change this to:

$postFields = array('https://api.constantcontact.com/ws/customers/{USERNAME}/lists/11');

I hope this helps. Please let us know if you have any other questions or concerns regarding this. Thanks.


David J

Developer Portal

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

Visit Page