capitalalist Posted March 31, 2012 Share Posted March 31, 2012 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 https://forums.phpfreaks.com/topic/260072-cant-work-out-if-my-syntax-is-wrong/ Share on other sites More sharing options...
timmah1 Posted April 1, 2012 Share Posted April 1, 2012 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 https://forums.phpfreaks.com/topic/260072-cant-work-out-if-my-syntax-is-wrong/#findComment-1333191 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.