The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

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

Highlighted
New Member

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

Hello



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?

Thanks

1 REPLY 1
Highlighted
Employee

Re: Useing PHP sample code to create a custom email signup form

Hello,


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

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured