Welcome to WebmasterWorld Guest from 54.159.111.156

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

help with mailchimp script

trying to get first name to pass

     
9:28 pm on Jul 21, 2012 (gmt 0)

5+ Year Member



Im able to use this [gist.github.com ] script but I am unable to get the first name to pass, any ideas how to do? I've tried everything I can think of!
7:47 pm on Jul 22, 2012 (gmt 0)

WebmasterWorld Administrator ergophobe is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Can you add another form field that captures first name and then just try to echo it out and stop, rather than sending it on to mailchimp?

At least then you would know where your script is failing.
8:09 pm on Jul 22, 2012 (gmt 0)

5+ Year Member



its somewhere in here

$data = array(
'email_address'=>$email,
'apikey'=>$apiKey,
'id' => $listId,
'double_optin' => $double_optin,
'send_welcome' => $send_welcome,
'email_type' => $email_type
);

Ive tried everything
first_name
fname
firstname
firstName
FirstName


just dont know what the key is..? anyone have any ideas or messed with this before?
8:26 pm on Jul 22, 2012 (gmt 0)

WebmasterWorld Administrator ergophobe is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Why do you think it's in there? Is it collecting first name on the form?

Have your form go to whatever script and output $_REQUEST with a print_r() or vardump() and see what's in there.
9:03 pm on Jul 22, 2012 (gmt 0)

5+ Year Member



I know my form is getting the data, its just not passing it into mailchimp because I dont know the key name.

this data array is built from the post data and send to mail chimp using curl, i need to know how to modify the data array so that it sends the first name, for instance

$data = array(
'first_name'=>$first_name,
'email_address'=>$email,
'apikey'=>$apiKey,
'id' => $listId,
'double_optin' => $double_optin,
'send_welcome' => $send_welcome,
'email_type' => $email_type
);
5:01 am on Jul 23, 2012 (gmt 0)

WebmasterWorld Administrator ergophobe is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



It won't be something like

'first_name'=>$first_name,

It will be something like

'first_name'=>$_POST['first_name'],


You need to output your post data and see how the array is constructed. Like I said, print_r($_REQUEST) before passing off to cURL and you should get your answer.
6:56 am on Jul 23, 2012 (gmt 0)

10+ Year Member



Try
'FNAME'=>$first_name,
11:59 pm on Jul 23, 2012 (gmt 0)

5+ Year Member



Yeah I tried that a it did not work? confused...
5:43 pm on Jul 24, 2012 (gmt 0)

WebmasterWorld Administrator ergophobe is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Maybe I'm not understanding where your fail point is.

Have you output the post data from the form and verified the name of the post variable that is passing the first name data?

If so, then it's a question of looking into the MailChimp API, but until you do that, I can't help.
7:31 pm on Jul 24, 2012 (gmt 0)

5+ Year Member



yeah it has something to do with the API which I've looked at and could not figure out, was hoping that someone had done this before and knew what it might be.
6:04 pm on Jul 28, 2012 (gmt 0)

WebmasterWorld Administrator ergophobe is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Ah, got it. So it's on the API end you're having the problem.

Okay, in that case, you have to get it into the $merge_vars array, so it needs to be

$merge_vars['FNAME'] = $_POST['firstname'];

$merge_vars = array('FNAME' => $_POST['firstname'], 'LNAME => $_POST['lastname']);

or whatever.

You also have to make sure the merge tag exists for a given list. You may have to ADD the merge var to a given list



[apidocs.mailchimp.com...]
[apidocs.mailchimp.com...]


All of these are list-related functions - you can search for "merge_vars" in this list:
[apidocs.mailchimp.com...]

See also
[kb.mailchimp.com...]
 

Featured Threads

Hot Threads This Week

Hot Threads This Month