How to add custom fields to Mailchimp Subscribe

2 replies · opened Aug 24, 2017

SsuppenhuhnAug 24, 2017

Hi!
I'm using the quickcontact-subscript.php on my website. In my Form i got Firstname + Lastname. These fields i put in the php-file into $fname and $name. I've changed the code line 88-91 as following:

				$data = array(
					'email_address' => $subscribe_email,
					'status' => 'subscribed',
'FNAME' => $fname,
'LNAME' => $name
						
					);

Both variables are working and available within the php-file. A new Subscriber is created on my list but it doesn't insert the names into my Mailchimp list. What i'm doing wrong?
Thanks in advance for any help:)

SSemicolon WebSTAFFAug 28, 2017

Hello,

Please consider using the following code as an Example to add your First Name and Last Name:

merge_vars = array();
if( $fname != '' ) { $merge_vars['FNAME'] = $fname; }
if( $lname != '' ) { $merge_vars['LNAME'] = $lname; }

$data = array(
	'email_address' => $email,
	'status' => 'subscribed'
);

if( !empty( $merge_vars ) ) { $data['merge_fields'] = $merge_vars; }

This will definitely work fine. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

SsuppenhuhnSep 5, 2017

Thank you! I'll try it right tommorrow :)

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard