Jump to content

Can't work out if my syntax is wrong


capitalalist

Recommended Posts

Hi all,

 

As always thanks in advance. My php skills are still at a beginner level but I'm trying to get there!

 

What I'm trying to do:

Send data to the Mailchimp api (specifically email, name, birthday)

 

What it currently does do:

Sends and stores email and name

 

What I cant get it to do:

Send and store the birthday from $birthday string.

 

First I load the form data:

 

//Load form data

$day = $_POST['Day'];

$month = $_POST['Month'];

$year = $_POST['Year'];

 

//Create Birthday in mm/dd format for mailchimp

$birthday = $month."/".$day;

 

Then I pass it later on to mailchimp:

 

$mergeVars = array('FNAME' => $parsedName['first'], 'LNAME' => $parsedName['last'], 'BDAY'=>"$birthday");

 

EVERYTHING in my script works perfectly except for the birthday bit.

 

So I tried this instead which DOES work, but doesn't use the form data defeating the whole point!

 

$mergeVars = array('FNAME' => $parsedName['first'], 'LNAME' => $parsedName['last'], 'BDAY'=>"04/04");

 

I thought it may be the $birthday string wasn't in the mm/dd setup. But after echo'ing it everything is fine.

 

I get the feeling I'm doing something stupid here. And I think it's syntax based around the 'BDAY'=>"$birthday" part.

 

Any help will be greatly appreciated! This is driving me INSANE.

 

Thanks,

Link to comment
Share on other sites

Might be stupid, but you're showing

Load form data $day = $_POST['Day']; $month = $_POST['Month']; $year = $_POST['Year']; //Create Birthday in mm/dd format for mailchimp $birthday = $month."/".$day;()

 

Then trying to get the results from $birthday, when you are not declaring the variable $birthday, it's commented out

 

Did you happen to try

$mergeVars = array('FNAME' => $parsedName['first'], 'LNAME' => $parsedName['last'], 'BDAY'=>"$day");()

 

Or at least uncomment

$birthday = $month."/".$day;()

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.