0

I've no idea where to go on this idea. I want to create a form that users can put onto their website, which when submitted will update a database on my server.

Is this possible? I'm guessing it would need to be an iframe? Just need some pointers on where to start, and what this is called.

halfer
  • 19,824
  • 17
  • 99
  • 186
Lovelock
  • 7,689
  • 19
  • 86
  • 186
  • You could make available a PHP script that users copy to their site and `include` in the right place. No `iframe` required! That can point to a script on your own server via the `action` attribute. – halfer Mar 21 '14 at 23:53

4 Answers4

1

This would not require an iframe or anything else "special". Your only requirement is a mysql server that allows external connections.

Full response covered here: Connecting to remote MySQL server using PHP

Community
  • 1
  • 1
0

I would first create a script on your own site that updates the database on behalf of the form

On the form code you can add an onsubmit handler that posts the data via ajax to your script that updates the database

0

Yes you can. See : cURL

With cURL, you can send data via POST and GET.

Fathan
  • 112
  • 1
  • 4
0

Method 1. Invisible to user; client can change form design and code.

Server.php is on your server. It gets POST data, validates it and updates DB.

Client.php is on your client's server. This script sends POST request to Server.php (with CURL or something).

Method 2. Visible to user; client can do nothing; you can change form design and code.

Yes, it is iFrame. Client just adds iFrame to his page, and you provide a page with form and PHP script.

Method 3. Direct connection to DB;

If you need to, client can connect to your DB as usual, with login, password and base name from PHP. But you need to open external connections for your DB.

LevChurakov
  • 113
  • 10
  • I think option 2 is best. As it would be randomer's posting to the DB. This is just a question really, not making anything as of yet but might do in the future. Great to know its possible though! – Lovelock Mar 22 '14 at 00:06