1

My client want to have form collecting the user data and save to external database that is on different hosting of the wordpress site.

I need to have two forms, one is for contact us purpose and the second for newsletter registering. Both forms need to collect the data and save it to the database on different tables.

I found plugin that let me make form on wordpress and plugin that let my save the data on the database wordpress use, but this in not what I need.

I found this solution Create a form and save data in a external DB with Wordpress but it do not help me.

I tried to run some PHP code (and learn it this way, because I do not know php) to get the data but I got nothing.

it is possible to do what I am asking? Is there some plugin to do this?

I do not ask for code, but some help will great.

Thanks

4
  • So do you want to save it on to a different wordpress site without any access to their code? that is not possible, however if you control both the wordpress sites, you can write a PHP code at the receiving website, post the form directly to that site and save it to the database, kindly explain Commented Aug 7, 2013 at 14:51
  • Thanks for the answer, I will try to explain better. I need only one wordpress site where the forms will be. The data will be sent to different host without site, only the database sit there. I need to get the data from the forms on the wordpress site and sent it to the database that is not on the hosting of the wordpress site. Hope I explain myself better. Commented Aug 8, 2013 at 5:42
  • So the database is in a different server and the wordpress is in a different server, is that right? In such a case can you tell me if only this form's data would be stored in the server that is remote or the entire wordpress database will reside in that different server? Commented Aug 8, 2013 at 7:20
  • That is right. Only the forms data would be stored in the server that is remote, I do not need stored the wordpress site data to the remote server. Commented Aug 8, 2013 at 8:18

1 Answer 1

1

The code in this page helps you create a second database connection, once you connect the second database, you can store data to it using routine WordPress database commands

http://bavotasan.com/2011/access-another-database-in-wordpress/

$newdb = new wpdb($DB_USER, $DB_PASSWORD, $DB_NAME, $DB_HOST);
$newdb->show_errors();

Hope this helps, let me know if there is still an issue.

Sign up to request clarification or add additional context in comments.

4 Comments

I am trying to understand what the issue is, because a select query here would be same as select query elsewhere, so do you want an example of connecting to a database and firing a query in wordpress
If you can show an example it will be nice, I tried to make one on the users table but I did not got any results
I found the way to make the select query "echo $obj->column_name;" But I did not manage to show 2 columns, like "echo $obj->column_name + "'<br/'> + $obj->column_name2";
Thanks for the help, I learn somethings, but in the end the client not wanting this

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.