Code Monkey home page Code Monkey logo

mailchimp-ajax-signup-php's Introduction

PhpMailchimpAjaxSignup

Simple signup Jquery plugin with PHP Script for Mailchimp v3 API.

Mailchimp Submission Plugin by Zach Zurn.

Example bare minimum form:

Include the script and jQuery on your page and create a form as shown below. No additional Javascript is needed.

<form action="/assets/mailchimp/" novalidate data-mailchimp="LIST-ID-GOES-HERE" data-redirect="URL-TO-REDIRECT-ON-SUCCESS">
    <input type="text" placeholder="Name" id="name" name="name" required data-validation-required-message="Please enter your name" />
    <input type="email" placeholder="Email Address" id="email" name="email" email data-validation-email-message="Please enter a valid email address" required data-validation-required-message="Please enter your email address" />
</form>

The 'data-mailchimp' attribute tells the plugin to use this form for mailchimp submissions and should have the list id as it's attribute.

The 'action' attribute must point to the mailchimp php file which has the apiKey.

Forms must have a field named "email" and either a field named "name" or fields named "first_name" and "last_name". These are the required fields for mailchimp. Any additional fields will be added to the MailChimp merge_fields.

Example checkbox for subscribing to interest group shown below.

In this example 'da3efd8270' is the interest id.

<input type="checkbox" name="interest-da3efd8270" id="interest-da3efd8270"><label for="interest-da3efd8270"> Host</label>

Example input for custom merge_field.

<input type="text" placeholder="Describe Yourself" id="MMERGE10" name="MMERGE10" />

Basic Validation

Supported Validation is 'required' and 'email' at the moment.

'required' attribute needs to also have a 'data-validation-required-message' attribute. 'email' attribute needs to also have a 'data-validation-email-message' attribute.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.