0

Does anybody know how i handle multiple actions on a form. In my case i want to add an action that sends a subscribed member of a newsletter to Mailchimp but i all ready have form action on the html form. Does anybody know a work around?

<form action="/form/post/13" id="cta-form" method="post" enctype="multipart/form-data" data-h5-instanceid="0" novalidate="novalidate">

as you can see i all ready have an actions which pushes the data into the database.

But i also need this:

<form action="http://mailchimp.us8.list-manage.com/subscribe/post" method="POST">

how can i do this?

Sireini
  • 4,142
  • 12
  • 52
  • 91

1 Answers1

0

Are the form tags nested? that could be the problem.

have a look at this post: multiple form tags in page or one form tag?

Community
  • 1
  • 1
Mark Handy
  • 1,180
  • 1
  • 11
  • 23
  • I know but is there a way to work around and have multiple actions on one form? – Sireini Mar 22 '16 at 14:38
  • No, the data has to go somewhere. that processing action should then handle the multiple tasks that you want. – Mark Handy Mar 22 '16 at 14:39
  • And how do you suggest to do this? because i need the info of this form to be send to the database and mailchimp. – Sireini Mar 22 '16 at 14:41
  • something like this? http://stackoverflow.com/questions/16660734/html-form-with-multiple-actions – Sireini Mar 22 '16 at 14:42
  • That example still has one action attribute in the form tag. In your case, where your data is process needs to submit to the DB, then send to MailChimp. How will depend on the language you are using. You'll also need to look at the MailChimp API: https://apidocs.mailchimp.com/ – Mark Handy Mar 22 '16 at 14:44
  • hmm okay we use twig – Sireini Mar 22 '16 at 15:06
  • You'll need to write custom PHP code for this. Twig is a framework built on PHP, and i'm not an expert at either Twig or PHP. – Mark Handy Mar 22 '16 at 15:07
  • me neither! Thanks for your help – Sireini Mar 22 '16 at 15:10
  • No problem. mail chimp should have some started php code which should help. Good Luck! – Mark Handy Mar 22 '16 at 15:11