amilks
Active Member
Hello Guys,
It's been a while, but I am enjoying the new Fabrik very much. I am currently rebuilding a 2.0 Fabrik app in 3.0 and so far it has gone really well. However I hit a snag. I need a few forms to submit the info to Mailchimp. I had actually written a script to do just that and it works. I also noticed that you have a Mailchimp plugin. I tried both. Here are the issues:
The official Fabrik Mailchimp plugin:
On the Module form with no ajax I get a white page. Seems like some form of PHP error. On the ajax form I get a notice in the console about a json error.
So I moved back to my script:
On the module form with no ajax It works correctly. I am signed up and then redirected.
On the Ajax form I get this error at the top of the form: SyntaxError: JSON.parse: unexpected character
And at this point I am posting here. I don't really have a preference between my script or the plugin, I just need one to work. Here is my script:
I then need it to redirect to a thank you page. This works on the module form and I am assuming once the php plugin works on the ajax it will redirect just like the module without ajax.
Thanks guys!!!!
It's been a while, but I am enjoying the new Fabrik very much. I am currently rebuilding a 2.0 Fabrik app in 3.0 and so far it has gone really well. However I hit a snag. I need a few forms to submit the info to Mailchimp. I had actually written a script to do just that and it works. I also noticed that you have a Mailchimp plugin. I tried both. Here are the issues:
The official Fabrik Mailchimp plugin:
On the Module form with no ajax I get a white page. Seems like some form of PHP error. On the ajax form I get a notice in the console about a json error.
So I moved back to my script:
On the module form with no ajax It works correctly. I am signed up and then redirected.
On the Ajax form I get this error at the top of the form: SyntaxError: JSON.parse: unexpected character
And at this point I am posting here. I don't really have a preference between my script or the plugin, I just need one to work. Here is my script:
Code:
<?php
$email = $_POST['jos_fbk_apply___email'];
$who = $_POST['jos_fbk_apply___information_for'];
$what = $_POST['jos_fbk_apply___interest'];
$first_name = $_POST['jos_fbk_apply___first_name'];
$last_name = $_POST['jos_fbk_apply___last_name'];
$dob = $_POST['jos_fbk_apply___dob'];
$home_value = $_POST['jos_fbk_apply___home_value'];
$mortgage = $_POST['jos_fbk_apply___mortgage'];
$co_first = $_POST['jos_fbk_apply___first_name_co'];
$co_last = $_POST['jos_fbk_apply___last_name_co'];
$co_dob = $_POST['jos_fbk_apply___dob_co'];
$address = $_POST['jos_fbk_apply___address'];
$city = $_POST['jos_fbk_apply___city'];
$state = $_POST['jos_fbk_apply___state'];
$zip = $_POST['jos_fbk_apply___zip'];
$phone = $_POST['jos_fbk_apply___phone'];
$newsletter = $_POST['jos_fbk_apply___newsletter_raw'];
if($newsletter[0] == 'yes'){
if(!$email)
{
return "No email address provided";
}
if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$/i", $email))
{
return "Email address is invalid";
}
require_once('lib/MCAPI.class.php'); /*('/hermes/web10/b2767/pow.biimls/htdocs/mlsreversemortgage/lib/MCAPI.class.php');*/
$api = new MCAPI('6cf660c233cdb22a3d8afc462bad36e7-us2');
$list_id = "66c4ca406c";
$mergeVars = array(
'WHO'=>$who,
'WHAT'=>$what,
'FNAME'=>$first_name,
'LNAME'=>$last_name,
'DOB'=>$dob,
'HOME'=>$home_value,
'MORTGAGE'=>$mortgage,
'COFIRST'=>$co_first,
'COLAST'=>$co_last,
'CODOB'=>$co_dob,
'SADDRESS'=>$address,
'CITY'=>$city,
'STATE'=>$state,
'ZIP'=>$zip,
'PHONE'=>$phone
);
if($api->listSubscribe($list_id, $email, $mergeVars) === true)
{
echo 'Success! Check your email to confirm sign up.';
}
else
{
echo 'Error: ' . $api->errorMessage;
}
}
?>
I then need it to redirect to a thank you page. This works on the module form and I am assuming once the php plugin works on the ajax it will redirect just like the module without ajax.
Thanks guys!!!!