How Can I Create a Form to Submit to Multiple Databases?

Here's what we're trying to accomplish:

We have one form that submits data to a third party site. That form is very simple and works fine. We want to create a Gravity Form (or some other form database software) that will not only save all entries submitted to the Gravity database but will also send each submission to the third party site. Essentially, we need to be able to send to two forms using a single submission.

Gravity Forms is a very popular form plugin for WordPress that saves entries to a database. It's pretty straightforward, but doesn't have documentation for this particular issue:

How can we program a single button to submit to two different forms?
Who is Participating?

Improve company productivity with a Business Account.Sign Up

sc456aConnect With a Mentor Author Commented:
I ended up using a custom built script and code in the Gravity Form to get this going.
Jason C. LevineNo oneCommented:
Technically it isn't that hard to do.   When you submit the form, you capture the form variables with PHP and then open a connection to database 1 and write the row, then close that connection and open a new one to database 2 and repeat.

However, if you are trying to do this within gravity forms, you are going to run into issues because the plugin is simply not designed to do this. Must this happen from within Wordpress or were you just using that to illustrate the issue?
sc456aAuthor Commented:
We are using WordPress for the site template, but we can write to another database to store the form entries - that doesn't really matter. The tricky part is that we have to use certain field IDs that match the existing fields on the third party database. So far I can't find a WordPress form plugin or form utility that will allow us to customize field IDs - they always append some code which can't be modified or removed.

I think what we're trying to do is simple, just as you mentioned, but we're having a tough time finding the best software to get it done.
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

Jason C. LevineNo oneCommented:
You will probably not find something that fulfills your requirements. You're going to need to write your own PHP.

What I would do is create a custom page template in Wordpress and use that to hold all of the custom PHP needed to submit the form data to two places.  This bypasses the need to find a plugin but allows you to use all of the functionality of Wordpress still.

Explains how to create a page template.  Once you have it, all you need to do is add your form and handling code.  Alternately, just create the form in Wordpress using the HTML tab of the visual editor but point the form to an external PHP file that does the processing.
Sathish David Kumar NArchitectCommented:
better you go for Web services .... onces your one DB save process over call your web services then it will update ur another DB .

other solution is RMI
Use Ajax, you can then submit to as many sites as you wish.
sc456aAuthor Commented:
I was hoping someone might know of a WordPress plugin or form software package that could accomplish this without custom programming, or at least with very little. If no one knows of anything, I'll just bid it out.
Jason C. LevineConnect With a Mentor No oneCommented:
I've looked at more form plugins than I care to remember.  None of them are configured to do a dual write so either you will be bidding out to alter the plugin or bidding out to create new functionality.
sc456aAuthor Commented:
No one really provided a solution so I had one built, but partial credit to Jason for looking into it and giving an honest assessment.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.