ohboyatoytruck Posted December 9, 2014 Share Posted December 9, 2014 Hi there, Mailchimp supplies web form code for adding subscribers from a web page. I need to adapt this code so that instead of form fields, php variables get passed on to mailchimp. This is because the form fields are part of another form and you can have forms in forms. The variables I need to pass to Mailchimp a rev as follows: $firstname $lastname $email These variables have been passed from an earlier form via $_POST with similar names e.g. firstName, lastName and email. The mailchimp form code is below with the id numbers replaced with XXX, YYY and ZZZ <form action="//asn.us7.list-manage.com/subscribe/post?u=XXX;id=YYY" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate> <h2>Subscribe to our mailing list</h2> <div class="mc-field-group"> <label for="mce-EMAIL">Email Address*</label> <input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL"> </div> <div class="mc-field-group"> <label for="mce-FNAME">First Name </label> <input type="text" value="" name="FNAME" class="" id="mce-FNAME"> </div> <div class="mc-field-group"> <label for="mce-LNAME">Last Name </label> <input type="text" value="" name="LNAME" class="" id="mce-LNAME"> </div> <div id="mce-responses" class="clear"> <div class="response" id="mce-error-response" style="display:none"></div> <div class="response" id="mce-success-response" style="display:none"></div> </div> <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups--> <div style="position: absolute; left: -5000px;"><input type="text" name="ZZZ" tabindex="-1" value=""></div> <div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div> </form> All assistance gratefully received. Quote Link to comment Share on other sites More sharing options...
requinix Posted December 10, 2014 Share Posted December 10, 2014 MailChimp has an api for doing exactly this. Have your code send a subscribe request to MailChimp instead of using the form method. Quote Link to comment Share on other sites More sharing options...
ohboyatoytruck Posted December 10, 2014 Author Share Posted December 10, 2014 MailChimp has an api for doing exactly this. Have your code send a subscribe request to MailChimp instead of using the form method. Im sorry but I don't know how to send a subscribe request to MAilchimp - the code in the link you provided is beyond me Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.