How do I configure my "leave a message" form with MailChimp on an HTML/CSS template?

329 Views Asked by At

How do I configure my "leave a message" form with MailChimp on an HTML / CSS template?

The only instruction the template gave was replace UR_EMAIL and put your MailChimp custom URL so I'm wondering where I did something wrong.

This is my JavaScript:

$(document).ready(function () {
  'use strict';
  $('#subscription-form').ajaxChimp({
    callback: mailchimpCallback,
    url: 'http://github.us14.list-manage.com/subscribe?u=5e21caa786b5659f6871a1ac4&id=507de619ad' /* Replace it with your custom URL inside '' */
  });

  function mailchimpCallback(resp) {
    if (resp.result === 'success') {
      $('.subscription-success')
        .html(resp.msg)
        .delay(500)
        .fadeIn(1000);

      $('.subscription-success').fadeOut(8000);

    } else if (resp.result === 'error') {
      $('.subscription-failed')
        .html(resp.msg)
        .delay(500)
        .fadeIn(1000);

      $('.subscription-failed').fadeOut(5000);
    }
    $('#subscription-form .input-email').val('');
  };
});

This is my contact form:

<?php 

  $name = $_REQUEST[ 'contact-name' ];
  $email = $_REQUEST[ 'contact-email' ];
  $subject = $_REQUEST[ 'contact-subject' ];
  $message = $_REQUEST[ 'contact-message' ];
  $mail_subject = $subject . "( Customer Contact )";
  $message = "Name: ".$name." || Email: ".$email." || Subject: ".$subject." || Message: ".$message;

  /* Replace YOUR_MAIL With Your Mail Address inside '' */
  if ( mail( '[email protected]', $mail_subject, $message, "From:" . $email ) ) {
    echo "Thank you <strong>$name</strong> for contacting with us !!!";
  } else {
    echo "Error in sending message !!! Please try again";
}
?>
0

There are 0 best solutions below