homepage Welcome to WebmasterWorld Guest from 54.234.225.23
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
help with mailchimp script
trying to get first name to pass
drooh




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

Im able to use this [url]https://gist.github.com/1488819[/url] 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!

 

ergophobe




msg:4478036
 7:47 pm on Jul 22, 2012 (gmt 0)

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.

drooh




msg:4478041
 8:09 pm on Jul 22, 2012 (gmt 0)

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?

ergophobe




msg:4478045
 8:26 pm on Jul 22, 2012 (gmt 0)

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.

drooh




msg:4478058
 9:03 pm on Jul 22, 2012 (gmt 0)

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
);

ergophobe




msg:4478108
 5:01 am on Jul 23, 2012 (gmt 0)

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.

Gibisan




msg:4478117
 6:56 am on Jul 23, 2012 (gmt 0)

Try
'FNAME'=>$first_name,

drooh




msg:4478306
 11:59 pm on Jul 23, 2012 (gmt 0)

Yeah I tried that a it did not work? confused...

ergophobe




msg:4478479
 5:43 pm on Jul 24, 2012 (gmt 0)

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.

drooh




msg:4478506
 7:31 pm on Jul 24, 2012 (gmt 0)

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.

ergophobe




msg:4479761
 6:04 pm on Jul 28, 2012 (gmt 0)

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...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved