Send Variable to Form using GET - Signup to Specific List?

Occasional Participant

Send Variable to Form using GET - Signup to Specific List?

Hi,


I am hoping that this is possible with the API- I would like to link to a basic form (I called it signup.php) with a variable at the end of the URL ?list=24 (or maybe the name of the list). The form would use/send data to whatever list was specified in the URL.

 


So, if someone clicked on a link with ?list=24 at the end of the URL it would add them to the list in my account with an id of 24. I can use the actual name of the signup list too if I need to. 


 


This must be possible - I cannot seem to get my head around it though. Any help would be appreciated. 


 


Thanks,

Ben

3 REPLIES 3
Employee

You could set up a page (ie: www.yourwebsite.com?list=24 ) which would allow them to either fill out their information to create a new contact, or update their details if the subscriber already exists. Upon submission of this page, it would make an HTTP request to either create or update the contact to be subscribed to list 24.


 


Each active contact in your account will have contact list subscriptions described in the <ContactLists> element of the contact details. Each particular list that the contact is a part of will be represented by a <ContactList> element inside <ContactLists>. To modify which lists a contact is subscribed to, you would want to add or remove the appropriate <ContactList> element. I would recommend taking a look at Adding or Removing a Contact from a List for more information on this process.


 


I hope this helps to clear up any points of confusion. Please let us know if you have any other questions. Thanks.

David J

Occasional Participant

 Are there any php examples out there that demonstrate this? I basically want to force the addition of the subscriber to the second list (or update their details).



I have it working at the moment but instead of adding the user to the second list it provides a message to "email the webmaster and request to be manually added to the mailing list". This will work as a stop-gap for a little while but I'd like to figure it out at some point.


It would be nice if there was a prebuilt script included with the PHP Form Samples that did this.


Has anyone modified add_contact.php to do this?


Employee

You could modify the php sample to force users to join just one specific list. You can do this by specifying the name of the list(s) you want to force contacts to join in the $contact_lists array on line 18 of cc_class.php. You could also set $force_lists to 'true' and $show_contact_lists to 'false'. This will force all contacts using the form to join the list you specify in $contact_lists and not give them the option to modify or even see their contact lists selections.

David J

Developer Portal

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

Visit Page