0

I have been trying to get a form to post the Name, Job Title, Company and email to a List on MailChimp. I have seen and attempted some solutions I have seen in the Github Repository and SO but none have worked as intended. The form pushes the email to the list just not the other 3 fields. I am also not very familiar with Backend development so I apologize if the solution is staring me in the face and I am just not seeing it.

Form Markup

<form action="notify-me.php" id="notifyMe" method="POST" class="center-block align-center col-lg-5 col-md-5 col-sm-10 col-xs-10">
                <div class="input-group col-lg-12 align-center">
                    <input type="text" class="form-control email-add" name="NAME" placeholder="Enter Your Name">
                    <input type="text" class="form-control email-add" name="TITLE" placeholder="Enter Job Title">
                    <input type="text" class="form-control email-add" name="COMPANY" placeholder="Enter Your Company">
                  <input type="text" class="form-control email-add" name="EMAIL" placeholder="Enter Email Address">
                  <button class="btn btn-default notify-button"><i class="fa fa-paper-plane"></i><span>Send</span></button>
                </div>
            </form>

PHP

$name = $_POST["name"];
$job = $_POST["title"];
$company = $_POST["company"];
$email = $_POST["email"];
$MailChimp = new MailChimp($API_KEY);

        $result = $MailChimp->call('lists/subscribe', array(
                    'id'                => $LIST_ID,
                    'NAME'              => array('name'=>$email),
                    'JOB'               => array('job'=>$job),
                    'COMPANY'           => array('company'=>$company),
                    'email'             => array('email' => $email),
                    'double_optin'      => false,
                    'update_existing'   => true,
                    'replace_interests' => false,
                    'send_welcome'      => false,
                ));
Cakewok
  • 15
  • 5

0 Answers0