The contact list array

SOLVED
Go to solution
Regular Participant

The contact list array

AS per Constant Contact sample form,  there is this general interest as default list but it  is being  sent using hidden html tag as List array. Is there  away whre i can pass postfield array with hard coded value ?  say the list type prints

in php the following

Array ( [0] => Array ( [id] => http://api.constantcontact.com/ws/customers/constantsurya/lists/1 [title] => General Interest ) )

 

how will i  hard code it for the posttfield array like I hard for  first name last name email address, without the need for hidden field?

 

Pls help thanx in advance

1 ACCEPTED SOLUTION

Hello Surya,

 

Ok, I see what you're trying to do.  A simple array of lists is expected by wrapper, so I think what you're going for to hardcode a specific list is something like this:

 

$postFields["lists"] =  array( "http://api.constantcontact.com/ws/customers/username/lists/1");

 

Essentially, that will set your desired list uri as the value of key "0" in the $postFields["lists"] array. You could add mutiple lists in the parentheses, each in quotes with a comma between them (additional keys and values in the array).

 

I hope that is helpful. Let me know if you have other questions.

 

Cheers,

Mark Coleman
Support Engineer

View solution in original post

3 REPLIES 3
Member

Hello,

 

I am not sure what you are trying to achieve.  Could you rephrase the question?  I'm not sure if you want to hard code the hidden list input fields in your form, or hard-code the array of values instead of accepted them as part of the data posted when the form is submitted.  If you can offer some clarification, I will do what I can to help.

 

Cheers, 

Mark Coleman
Support Engineer
Regular Participant

 following is the excerpted code


        $postFields["email_address"] = "email@email.com";
        $postFields["first_name"] = "timarmy";
        $postFields["last_name"] = "dude";
        $postFields["mail_type"] = "HTML";

 

no if i need to specify  the list type (default general list) how do I hard code   it like the  way i have done above

 

will  $postFields["lists"] =1  or  $postFields["lists"] = "http://api.constantcontact.com/ws/customers/constantsurya/lists/1"
will do? 

 

doing all of these  i get  erros like your are missing you list

 

since "lists is an hidden html field array like this 

 

 echo '<input type= "hidden" name="lists[]" value="http://api.constantcontact.com/ws/customers/constantsurya/lists/1" id="chk_0" /><br />';

 

instead of using hidden html element how i simply pass exact list type, is there  a way

 

thnx in advance 

 

Surya Menon              

 

 

Hello Surya,

 

Ok, I see what you're trying to do.  A simple array of lists is expected by wrapper, so I think what you're going for to hardcode a specific list is something like this:

 

$postFields["lists"] =  array( "http://api.constantcontact.com/ws/customers/username/lists/1");

 

Essentially, that will set your desired list uri as the value of key "0" in the $postFields["lists"] array. You could add mutiple lists in the parentheses, each in quotes with a comma between them (additional keys and values in the array).

 

I hope that is helpful. Let me know if you have other questions.

 

Cheers,

Mark Coleman
Support Engineer

View solution in original post

Developer Portal

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

Visit Page