Hi all.
I am integrating a mailchimp subscribe form into an EE template. The form works, and allows the user to subscribe, but I have two notices appearing. I should mention no notices show when the form is in a standard page, not an EE template. I have set to allow PHP output on this form. I also tried input just to sure but both display the notices.
The form has a require_once:
<? require_once('-/inc/store-address.php'); if($_GET['submit']){ echo storeAddress(); } ?>and the store-address.php looks like:
<?php
function storeAddress(){
if(!$_GET['email']){ return "No email address provided"; }
if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$/i", $_GET['email'])) {
return "Email address is invalid";
}
require_once('MCAPI.class.php');
$api = new MCAPI('87610ca40190fdaf58907cea1c2eb2c7-us2');
$list_id = "245bd30377";
if($api->listSubscribe($list_id, $_GET['email'], '') === true) {
return 'Success! Check your email to confirm sign up.';
}else{
return 'Error: ' . $api->errorMessage;
}
}
if($_GET['ajax']){ echo storeAddress(); }
?>
I think the notices are refering to ‘submit’ in the require_once, and ‘ajax’ at the bottom of the store-address.php script.
How can I resolve this?