Forum
Mailchimp second form not working
Hello,
I have set up Mailchimp. I have a form in my footer which is working fine. Now I'm also trying to have a form in my post.php page. The form in the post.php gives a success message when clicking the button, but the subscriber is not added in the App.
My diagnostic report
Perch: 3.0.11, PHP: 5.6.32, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO
Server OS: Linux, apache2handler
Installed apps: content (3.0.11), assets (3.0.11), categories (3.0.11), perch_blog (5.6.1), perch_forms (1.9.1), perch_mailchimp (3.1)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_forms', 'perch_mailchimp', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /home/smngvt/domains/samengevat.nu/public_html/perch
PERCH_CORE: /home/smngvt/domains/samengevat.nu/public_html/perch/core
PERCH_RESFILEPATH: /home/smngvt/domains/samengevat.nu/public_html/perch/resources
Image manipulation: GD
PHP limits: Max upload 64M, Max POST 64M, Memory: 128M, Total max file upload: 64M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
HTTP_HOST: www.samengevat.nu
DOCUMENT_ROOT: /home/smngvt/domains/samengevat.nu/public_html
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Debug on post.php page
Debug Message - Perch 3.0.11
[35] SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
[1] SELECT * FROM perch2_mailchimp_lists WHERE listMailChimpID='086449a03c' LIMIT 1
Subscribing to: Samengevat.NU - bijdrage
Array
(
[headers] => Array
(
[url] => https://us15.api.mailchimp.com/3.0/lists/086449a03c/members
[content_type] => application/problem+json; charset=utf-8
[http_code] => 400
[header_size] => 421
[request_size] => 410
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0.258721
[namelookup_time] => 0.036467
[connect_time] => 0.040698
[pretransfer_time] => 0.075623
[size_upload] => 76
[size_download] => 322
[speed_download] => 322
[speed_upload] => 76
[download_content_length] => 322
[upload_content_length] => 76
[starttransfer_time] => 0.258547
[redirect_time] => 0
[redirect_url] =>
[primary_ip] => 184.50.164.58
[certinfo] => Array
(
)
[primary_port] => 443
[local_ip] => 46.21.169.104
[local_port] => 54514
[request_header] => POST /3.0/lists/086449a03c/members HTTP/1.0
Host: us15.api.mailchimp.com
User-Agent: DrewM/MailChimp-API/3.0 (github.com/drewm/mailchimp-api)
Accept-Encoding: deflate, gzip
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Authorization: apikey f21b7d6928025cee994272d80d897488-us15
Content-Length: 76
)
[body] => {"type":"https://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/","title":"Invalid Resource","status":400,"detail":"The resource submitted could not be validated. For field-specific details, see the 'errors' array.","instance":"13fb07b5-a6b8-40c7-a2d8-b9e1a3809211","errors":[{"field":"","message":"Required fields were not provided: email_address"},{"field":"email_address","message":"Schema describes string, NULL found instead"}]}
)
[1] SELECT SQL_CALC_FOUND_ROWS DISTINCT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' JOIN perch2_blog_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='postID' AND idx2.indexKey='_id' WHERE 1=1 AND ((idx.indexKey='postSlug' AND idx.indexValue='maximumsnelheid-naar-130-lees-alle-voor-en-tegenargumenten')) AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue, postID ) as tbl WHERE (postStatus='Published' AND postDateTime<='2017-11-30 17:11:00' ) GROUP BY itemID, sortval ORDER BY sortval ASC LIMIT 0, 10
[1] SELECT FOUND_ROWS() AS `count`
[1] Using template: /templates/blog/post.html
[2] SELECT * FROM perch2_blog_authors ORDER BY authorFamilyName, authorGivenName ASC
[1] SELECT * FROM perch2_blog_sections ORDER BY sectionTitle ASC
[3] SELECT * FROM perch2_blogs ORDER BY blogTitle ASC
[2] SELECT * FROM perch2_categories ORDER BY catTreePosition ASC
[7] SELECT catID, catPath FROM perch2_categories
[1] SELECT SQL_CALC_FOUND_ROWS DISTINCT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' JOIN perch2_blog_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='postID' AND idx2.indexKey='_id' WHERE 1=1 AND ((idx.indexKey='postSlug' AND idx.indexValue='maximumsnelheid-naar-130-lees-alle-voor-en-tegenargumenten')) AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue, postID ) as tbl WHERE (postStatus='Published' AND postDateTime<='2017-11-30 17:11:00' ) GROUP BY itemID, sortval ORDER BY sortval ASC LIMIT 0, 10
[1] SELECT FOUND_ROWS() AS `count`
[1] Using template: /templates/blog/meta_head.html
[35] SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
[1] SELECT * FROM perch2_pages WHERE pagePath='/blog/post.php' LIMIT 1
Using template: /templates/pages/attributes/default.html
Using sub-template: /templates/pages/attributes/seo.html
Using sub-template: /templates/pages/attributes/facebook.html
Using sub-template: /templates/pages/attributes/twitter.html
[8] SELECT SQL_CALC_FOUND_ROWS DISTINCT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' JOIN perch2_blog_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='postID' AND idx2.indexKey='_id' WHERE 1=1 AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue, postID ) as tbl WHERE (postStatus='Published' AND postDateTime<='2017-11-30 17:11:00' ) GROUP BY itemID, sortval ORDER BY sortval ASC LIMIT 0, 8
[1] SELECT FOUND_ROWS() AS `count`
[8] Using template: /templates/blog/recent_underpost.html
Using template: /templates/mailchimp/forms/test.html
[4] SELECT SQL_CALC_FOUND_ROWS DISTINCT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' JOIN perch2_blog_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='postID' AND idx2.indexKey='_id' WHERE 1=1 AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue, postID ) as tbl WHERE (postStatus='Published' AND postDateTime<='2017-11-30 17:11:00' ) GROUP BY itemID, sortval ORDER BY sortval ASC LIMIT 0, 4
[1] SELECT FOUND_ROWS() AS `count`
[4] Using template: /templates/blog/sidebar_recent.html
Fetching from cache: perch_blog_categories589c7a634eb12f2ec225cfedc7dc78ae
[3] SELECT SQL_CALC_FOUND_ROWS DISTINCT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch2_blog_index idx JOIN perch2_blog_posts main ON idx.itemID=main.postID AND idx.itemKey='postID' JOIN perch2_blog_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='postID' AND idx2.indexKey='_id' WHERE 1=1 AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue, postID ) as tbl WHERE (postStatus='Published' AND postDateTime<='2017-11-30 17:11:00' ) GROUP BY itemID, sortval ORDER BY sortval ASC LIMIT 0, 3
[1] SELECT FOUND_ROWS() AS `count`
[3] Using template: /templates/blog/recent_footer.html
Array
(
[type] => 8
[message] => Undefined variable: email
[file] => /home/smngvt/domains/samengevat.nu/public_html/perch/addons/apps/perch_mailchimp/lib/PerchMailChimp_Subscribers.class.php
[line] => 68
Form template test.html (made simple for testing)
<perch:form class="form-js" id="subscribe" app="perch_mailchimp" action="#success">
<div class="form-input">
<i class="fa fa-user"></i>
<perch:input id="name" required="true" type="text" placeholder="Jouw Naam" mailer="FNAME" />
</div>
<!--<div class="form-input">
<i class="fa fa-home"></i>
<input type="url" name="url" id="url" placeholder="Kies">
</div>-->
<perch:input class="button" type="submit" value="Verzenden" id="btnsubmit" />
<perch:input type="hidden" value="1" id="confirm" mailer="confirm_subscribe" />
<perch:input type="hidden" id="list" value="086449a03c" mailer="list" />
<perch:success>
<p> Bedankt voor het inschrijven! </p>
</perch:success>
</perch:form>
Post.php form section
<div id="respond"><!-- Start respond Conmments -->
<div class="reply-title">
<h4 class="post_title">Je hebt zeker wel iets toe te voegen aan deze discussie? Help mee en draag bij!</h4>
</div><!-- COMMENT FORM -->
<div class="comment-form">
<?php perch_mailchimp_form('forms/test'); ?>
</div>
</div>
What can be wrong? I updated to the newest perch, API is fine, other form works and everything is the same as other form, except that one is in the footer and this one on post.php with the other one still in the footer.
Where's your field for the email address?
Whoops, deleted it to make the form more simple. But even with the email field it's still not working.
Debug after email
Test.html template
Have you seen the error?
Okay, I've now got the form with only an emailadress required.
Debug still gives a long error, I have no idea what it means
What could this be? [body] => {"type":"https://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/","title":"Invalid Resource","status":400,"detail":"The resource submitted could not be validated. For field-specific details, see the 'errors' array.","instance":"e19532f4-f907-4925-aa59-2c83c3efd7c0","errors":[{"field":"","message":"Required fields were not provided: email_address"},{"field":"email_address","message":"Schema describes string, NULL found instead"}]}
I don't even have a message field?
You're not passing an email address through for some reason.
Try
mailer="email"
instead ofmailer="EMAIL"
I already tried that, that wasn't going to fix it.
I found the problem. I had to give mailer="MMERGE2" and mailer="MMERGE4" in my original form.
This is the full form working now:
Thanks for helping Drew.